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 
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 : [Technowell, Sangli] */
#include <stdio.h>
#include <conio.h>
#include <ctype.h>
#include <string.h>

int main(void)
	int len, i;
	char *str = "TECHNOEXAM";
	len = strlen(str);
		str[i] = tolower(str[i]); //tolower()
	printf("\n\t Using tolower() : %s",str);
		str[i] = toupper(str[i]); //toupper()
	printf("\n\n\t Using toupper() : %s",str);
	return 0;

Output :

	Using tolower() : Technoexam

	Using toupper() : TECHNOEXAM_

Leave A Comment

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