C language Isalnum () function: To determine whether a character is an English letter or a number
header file:
Isalnum () is used to determine whether a character is an English letter or a number, equivalent to Isalpha (c) | | IsDigit (c), whose prototype is:
"Parameter" C is the character you want to detect.
"Return value" if the parameter C is a letter or a number, if C is 0 ~ 9 A ~ z a ~ z returns not 0, otherwise return 0.
Note that isalnum () is a macro definition, not a true function.
"Instance" finds characters in the STR string that are English letters or numbers.
#include <ctype.h>
Main () {
char str[] = "123c@ #FDsP [E?";
int i;
for (i = 0; Str[i]!= 0; i++)
if (Isalnum (str[i)))
printf ("%c be an alphanumeric character\n", str[i));
Output results:
1 is a apphabetic character
2 is a apphabetic character 3 is a apphabetic character C is a
apphabetic Char Acter
F is a apphabetic character
D is a apphabetic character S is a apphabetic
character
P is a appha Betic character
E is a apphabetic character
C language Isalpha () function: To determine whether a character is an English letter
header file:
Isalpha () is used to determine whether a character is an English letter, equivalent to Isupper (c) | | Islower (c), whose prototype is:
"Parameter" C is the character that needs to be detected.
return value if parameter C is an English letter (a ~ z a ~ z), returns a value other than 0, otherwise returns 0.
Note that Isalpha () is a macro definition, not a true function.
"Instance" finds characters in the STR string that are English letters.
#include <ctype.h>
Main () {
char str[] = "123c@ #FDsP [E?";
int i;
for (i = 0; Str[i]!= 0; i++)
if (Isalpha (str[i)))
printf ("%c be an alphanumeric character\n", str[i));
Execution results:
C is a apphabetic character
F is a apphabetic character D is a apphabetic
character S is a
apphabetic C Haracter
P is a apphabetic character
E is a apphabetic character