#include <stdio.h>
#include <ctype.h>
void convertToUppercase( char *sPtr ); /* prototype */
int main()
{
char string[] = "characters and abcde";
printf( "The string before conversion is: %s", string );
convertToUppercase( string );
printf( "\nThe string after conversion is: %s\n", string );
return 0;
}
void convertToUppercase( char *sPtr )
{
while ( *sPtr != '\0' ) {
if ( islower( *sPtr ) ) {
*sPtr = toupper( *sPtr );
}
++sPtr;
}
}
|