C Reference Convert to upper case: toupper()

The function toupper() returns a uppercase character of the character that is put in.

toupper() source code example:


#include<stdio.h>
#include<ctype.h>

int main()
{
	int counter=0;
	char mychar;
	char str[]="TeSt THis seNTeNce.\n";

	while (str[counter])
	{
		mychar=str[counter];
		putchar (toupper(mychar));
		counter++;
	}
	return 0;
}

Note: the sentence will be converted to all uppercase letters.

This entry was posted in C Reference ctype.h Functions. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site. Tweet This! Tweet This! or use to share this post with others.

Leave a Reply: