[Previous]
[Contents]
[Next]

__iscsym()

test for a letter, underscore or digit

Synopsis:

#include <ctype.h>
int __iscsym( int c );

Description:

The __iscsym() macro tests for a letter, underscore or digit. These characters are valid in a C identifier, except for the first character, which cannot be a digit. The __iscsymf() macro tests for a character that can start a C symbol name.

Returns:

A nonzero value when the character is a letter, underscore or digit; otherwise, zero is returned.

Examples:

#include <stdio.h>
#include <ctype.h>

char chars[] = {'A', 0x80, '_', '9', '+'};

#define SIZE sizeof( chars ) / sizeof( char )

void main()
  {
    int   i;

    for( i = 0; i < SIZE; i++ ) {
      printf( "Char %c is %sa C symbol character\n",
        chars[i],
        ( __iscsym( chars[i] ) ) ? "" : "not " );
    }
  }

produces the output

Char A is a C symbol character
Char   is not a C symbol character
Char _ is a C symbol character
Char 9 is a C symbol character
Char + is not a C symbol character

Classification:

WATCOM

Safety:
Interrupt handler Yes
Signal handler Yes
Thread Yes

Caveats:

__iscsym() is a macro.

See also:

isalpha(), isalnum(), iscntrl(), __iscsymf(), isdigit(), isgraph(), islower(), isprint(), ispunct(), isspace(), isupper(), isxdigit(), tolower(), toupper()


[Previous]
[Contents]
[Next]