/* * SHOUT * print all characters in upper case * Doing it like java! * * Created on: August 2019 * Author: geoffreytowell * Modified: Feb 2021 */ #include #include #include #define LINE_LEN 256 // this keeps VSC from underlining NULL all the time. #ifndef NULL #define NULL (void *) 0 #endif void shout() { char line[LINE_LEN]; while (1) { if (NULL == fgets(line, LINE_LEN, stdin)) break; for (int ptr = 0; ptr < strlen(line); ptr++) { //printf("%d %c %d\n", ptr, line[ptr], line[ptr]); if (isalpha(line[ptr])) { line[ptr]=toupper(line[ptr]); } } printf("%s\n", line); } } int main(void) { shout(); }