Determines if a character is an uppercase letter (A?Z).
int isupper ( int c );
This function has the following parameter.
A value different from zero (i.e., true) if indeed c is an uppercase alphabetic letter. Zero (i.e., false) otherwise.
#include <stdio.h>
#include <ctype.h>
/*w ww . j ava 2 s .c om*/
int main (){
int i=0;
char str[]="Test String.\n";
char c;
while (str[i]){
c=str[i];
if (isupper(c)) c=tolower(c);
putchar (c);
i++;
}
return 0;
}
The code above generates the following result.
#include <stdio.h>
#include <ctype.h>
#include <locale.h>
//from w ww.j a v a 2 s .c o m
int main(void)
{
unsigned char c = '\xc6';
printf("In the default C locale, \\xc6 is %suppercase\n",
isupper(c) ? "" : "not " );
setlocale(LC_ALL, "en_GB.iso88591");
printf("In ISO-8859-1 locale, \\xc6 is %suppercase\n",
isupper(c) ? "" : "not " );
}
The code above generates the following result.