I have this:
I want to change lower letters to upper and vice versa in a string. However, the code only work for first word and skip the rest. Could someone give me a hint?Code:void toggleString(const char *str, char *toggled) { while ( *str != '\0') { if ( islower( *str ) ) /* if character is lowercase */ *toggled = toupper ( *str ); /* convert to uppercase */ else if ( isupper ( *str) ) *toggled = tolower ( *str ); ++str; /* move str to the next character */ ++toggled; } }
Thanks.