isalnum cpp code example

Example 1: isalnum in c

#include <stdio.h>
#include <ctype.h>
int main()
{
    char c;
    int result;

    c = '5';
    result = isalnum(c);
    printf("When %c is passed, return value is %d\n", c, result);

    c = 'Q';
    result = isalnum(c);
    printf("When %c is passed, return value is %d\n", c, result);

    c = 'l';
    result = isalnum(c);
    printf("When %c is passed, return value is %d\n", c, result);

    c = '+';
    result = isalnum(c);
    printf("When %c is passed, return value is %d\n", c, result);

    return 0;
}

Example 2: c++ isalphanum

string test = "Ab4 :";
std::isalnum(test[0]);	//true
std::isalnum(test[1]);	//true
std::isalnum(test[2]);	//true
std::isalnum(test[3]);	//false
std::isalnum(test[4]);	//false