/*====================================================================== Program : upper_case.c Author : www.vijaynetwork.com Description : Function to convert Lower Case String to Upper Case String. =======================================================================*/ /* File includes */ #include #include /* Defines */ #define DIFF_UPPER_CHAR 32 #define CHAR_Z 90 /* Function Declaration */ void todo_upper( char *t ); /* * main function */ int main( void ) { char test[ ] = "I like trees because they seem more resigned to the way they have to live than other things do."; printf( "Enter String to make Upper Case\n" ); gets( test ); todo_upper( test ); printf( "%s\n", test ); printf( "\t--www.vijaynetwork.com\n", test ); getch( ); } /* * Function Name: todo_upper * Arguments: takes char * as argumet. It returns nothing. * Description: Converts string characters to Upper Case. */ void todo_upper( char *t ) { int i; for( i = 0; i < strlen( t ); ++i ) { if( t[ i ] != DIFF_UPPER_CHAR && t[ i ] > CHAR_Z ) { t[ i ] = ( t[ i ] - DIFF_UPPER_CHAR ); } } }