This compiles ok, but im getting wrong results. Im am trying to print the alphabet twice, once in uppercase, then call a function that changes the character size to lowercase and prints it back.
My output is showing them both as uppercase letters. I cant see anything wrong with my convert function. Is it just some silly mistake I have made?
Heres what I have done:
Code:#include <stdio.h> #include <ctype.h> /*function prototype*/ void convert ( char* ); /*main function - begins program execution -----------------------------------*/ int main ( void ) { char let; for ( let = 'A'; let <= 'Z'; let++ ) { printf("%2c", let); } convert ( &let ); printf("\n\n"); for ( let = 'A'; let <= 'Z'; let++ ) { printf("%2c", let); } getchar(); /*freeze console output window*/ return 0; /*return value from int main*/ } void convert ( char *sPtr ) { while ( *sPtr != '\0' ) { if ( toupper ( *sPtr )) { *sPtr = islower ( *sPtr ); } sPtr++; } }