Tuesday, Jun 18th

Last update12:59:40 PM GMT

Implementing your own toUpper() and isUpper() functions

Write e-mail

toUpper()

argaiv1974

int toUpper(int ch)
{
 if(ch>='a' && c<='z')
 return('A' + ch - 'a');
 else
 return(ch);
}


isUpper()

int isUpper(int ch)
{
 if(ch>='A' && ch <='Z')
 return(1); //Yes, its upper!
 else 
 return(0); // No, its lower!
} 


Its important to know that the upper and lower case alphabets have continuous ASCII values.
A-Z - 65-90
a-z - 97-122

Share this post



Web Hosting