In the C Programming Language, the isalnum feature exams whether c is alphanumeric.
Syntax
The syntax for the isalnum function in the C Language is:
int isalnum(int c);
Parameters or Arguments
c
The value to test whether it is alphanumeric.
Note c is regarded to be alphanumeric if either isalpha(c) is authentic or isdigit(c) is true.
Returns
The isalnum function returns a nonzero price if c is alphanumeric and returns zero if c is now not alphanumeric.
Required Header
In the C Language, the required header for the isalnum characteristic is:
#include <ctype.h>
Applies To
In the C Language, the isalnum feature can be used in the following versions:
ANSI/ISO 9899-1990
isalnum Example
/* Example using isalnum by TechOnTheNet.com */
#include <stdio.h>
#include <ctype.h>
int main(int argc, const char * argv[])
{
/* Define a temporary variable */
unsigned char test;
/* Assign a test letter to the variable */
test = 'T';
/* Test to see if this character is alphanumeric */
if (isalnum(test) != 0) printf("%c is alphanumeric\n", test);
else printf("%c is not alphanumeric\n", test);
/* Assign a non-alphanumeric character to the variable */
test = '!';
/* Test to see if this character is alphanumberic */
if (isalnum(test) != 0) printf("%c is alphanumeric\n", test);
else printf("%c is not alphanumeric\n", test);
return 0;
}
When compiled and run, this application will output:
T is alphanumeric
! is not alphanumeric
Similar Functions
Other C features that are comparable to the isalnum function:
isalpha characteristic isdigit characteristic
See Also
Other C functions that are noteworthy when dealing with the isalnum function:
islower characteristic isupper feature
Leave a Review