 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What are character analysis function, explain with C program?
Character analysis and conversion functions
The predefined functions in “ctype.h” library is for analyzing the character input and converting them.
Analysis functions
| S.No | Function | Description | 
|---|---|---|
| 1 | isalpha() | An alphabet or not | 
| 2 | isdigit() | A digit or not | 
| 3 | isspace() | A space, a new line or tab | 
| 4 | ispunct() | A special symbol or not | 
| 5 | slower() | A lower case letter of alphabet | 
| 6 | isupper() | An upper case letter of alphabet | 
| 7 | isalphanumeric() | An alphabet/digit or not | 
Converting functions
| Function | Description | 
|---|---|
| tolower() | Converts an upper case alphabet to lower case | 
| toupper() | Converts a lower case alphabet to upper case | 
Example
Let us see a program to demonstrate character analysis and conversion functions −
#include<stdio.h> #include<ctype.h> void main(){    //Initializing compile time character variable// char variable = 'A';    //Reading User I/P//    //printf("Enter the character : ");    //scanf("%c",variable);    //Using character analysis function & printing O/p//    if (isalpha(variable)){       printf("The character entered is :%c, an alphabet",variable);    } else {       printf("The character entered is not an alphabet");    } } Output
The character entered is :A, an alphabet
Advertisements
 