Pages

Friday

What is CTYPE.H Header in C Programming Language?

Overview of CTYPE.H header in C Language

This header declares a set of functions which deals with individual characters of a String. The functions could be used to either classify characters e.g. whether a character is alphanumeric, blank, space or a control character or it could be used to perform some transformation on individual characters e.g. change a character to upper/lower case.

Functions available in CTYPE.H header in C Language

All functions in CTYPE.H take the int equivalent of one character as parameter and return an int that can either be another character or a value representing a Boolean value: an int value of 0 means false, and an int value different from 0 represents true.

Now let's take a look at some functions available in CTYPE.H.

Classification Functions in CTYPE.H Header in C Language

  • isalnum - Check if character is alphanumeric (function )
  • isalpha  - Check if character is alphabetic (function )
  • isblank - Check if character is blank (function )
  • iscntrl   - Check if character is a control character (function )
  • isdigit   - Check if character is decimal digit (function )
  • isgraph - Check if character has graphical representation (function )
  • islower - Check if character is lowercase letter (function )
  • isprint   - Check if character is printable (function )
  • ispunct - Check if character is a punctuation character (function )
  • isspace - Check if character is a white-space (function )
  • isupper - Check if character is uppercase letter (function )
  • isxdigit - Check if character is hexadecimal digit (function )

Character Transformation/Conversion Functions in CTYPE.H Header in C Language

  • tolower - Convert uppercase letter to lowercase (function )
  • toupper - Convert lowercase letter to uppercase (function )

Take a look at: Programs using CTYPE.H Header in C.

No comments:

Post a Comment