Character Functions header file(ctype.h) in C Programming

It contains the declarations for character functions i.e. it contains information used by the character classification and character conversion macros.
Some of the standard member functions of ctype.h header files are,

_________________________________________________________________
Function Name	Description
_________________________________________________________________
isalnum -	checks for alphanumeric character.
isalpha -	checks for alphabetic character.
isxdigit -	checks for hexadecimal digit.
isupper -	checks for upper case character.
isspace -	checks for any whitespace character.
ispunct -	checks for punctuation character.
isdigit -	checks for digits.
islower -	checks for lower case characters.
isprint -	checks for printable character with space 
                character.
isgraph -	checks for graphic character without 
                space character.
_________________________________________________________________

Program :

/*  Program to demonstrate ctype.h header file working.
Creation Date : 05 Nov 2010 02:18:12 AM
Author : www.technoexam.com [Technowell, Sangli] */
#include <stdio.h>
#include <conio.h>
#include <ctype.h>
#include <string.h>

int main(void)
{
	int len, i;
	char *str = "TECHNOEXAM";
	clrscr();
	len = strlen(str);
	for(i=1;i<=len;i++)
	{
		str[i] = tolower(str[i]); //tolower()
	}
	printf("\n\t Using tolower() : %s",str);
	for(i=1;i<=len;i++)
	{
		str[i] = toupper(str[i]); //toupper()
	}
	printf("\n\n\t Using toupper() : %s",str);
	getch();
	return 0;
}

Output :

	Using tolower() : Technoexam

	Using toupper() : TECHNOEXAM_

Leave A Comment

Your email address will not be published. Required fields are marked *