1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#include <stdio.h> void up_case(char *s) { char c; while (*s) { c = *s; if (c >= 'a' && c <= 'z') *s = (c - 'a') + 'A'; s++; } } void main() { char s[50]; printf("input string ? "); fgets(s, 50, stdin); up_case(s); printf("%s", s); }