ctype.h Flashcards
What is isalnum()?
int isalnum(int character);
a letter (A to Z or a to z) or a digit (0 to 9)
The is… functions test the given character and return a nonzero (true) result if it satisfies the following conditions. If not, then 0 (false) is returned.
What is isalpha()?
int isalpha(int character);
a letter (A to Z or a to z)
The is… functions test the given character and return a nonzero (true) result if it satisfies the following conditions. If not, then 0 (false) is returned.
What is iscntrl()?
int iscntrl(int character);
any control character (0x00 to 0x1F or 0x7F)
The is… functions test the given character and return a nonzero (true) result if it satisfies the following conditions. If not, then 0 (false) is returned.
What is isdigit()?
int isdigit(int character);
a digit (0 to 9)
The is… functions test the given character and return a nonzero (true) result if it satisfies the following conditions. If not, then 0 (false) is returned.
What is isgraph()?
int isgraph(int character);
any printing character except for the space character (0x21 to 0x7E)
The is… functions test the given character and return a nonzero (true) result if it satisfies the following conditions. If not, then 0 (false) is returned.
What is islower()?
int islower(int character);
a lowercase letter (a to z)
The is… functions test the given character and return a nonzero (true) result if it satisfies the following conditions. If not, then 0 (false) is returned.
What is isprint()?
int isprint(int character);
any printing character (0x20 to 0x7E)
The is… functions test the given character and return a nonzero (true) result if it satisfies the following conditions. If not, then 0 (false) is returned.
What is ispunct()?
int ispunct(int character);
any punctuation character (any printing character except for space character or isalnum)
The is… functions test the given character and return a nonzero (true) result if it satisfies the following conditions. If not, then 0 (false) is returned.
What is isspace()?
int isspace(int character);
a whitespace character (space, tab, carriage return, new line, vertical tab, or formfeed)
The is… functions test the given character and return a nonzero (true) result if it satisfies the following conditions. If not, then 0 (false) is returned.
What is isupper()?
int isupper(int character);
an uppercase letter (A to Z)
The is… functions test the given character and return a nonzero (true) result if it satisfies the following conditions. If not, then 0 (false) is returned.
What is isxdigit()?
int isxdigit(int character);
a hexadecimal digit (0 to 9, A to F, or a to f)
The is… functions test the given character and return a nonzero (true) result if it satisfies the following conditions. If not, then 0 (false) is returned.
What is tolower()?
int tolower(int character);
If the character is an uppercase character (A to Z), then it is converted to lowercase (a to z)
The to… functions provide a means to convert a single character. If the character matches the appropriate condition, then it is converted. Otherwise the character is returned unchanged.
Example:
#include #include #include
int main(void) { int loop; char string[]="THIS IS A TEST";
for(loop=0;loop string[loop]=tolower(string[loop]); printf("%s\n",string); return 0; }
What is toupper()?
int toupper(int character);
If the character is a lowercase character (a to z), then it is converted to uppercase (A to Z)
The to… functions provide a means to convert a single character. If the character matches the appropriate condition, then it is converted. Otherwise the character is returned unchanged.
Example:
#include<ctype.h><br> #include<stdio.h><br> #include<string.h></string.h></stdio.h></ctype.h>
int main(void) { int loop; char string[]="THIS IS A TEST";
for(loop=0;loop<strlen></strlen> string[loop]=tolower(string[loop]); printf("%s\n",string); return 0; }