isascii, __isascii

test for a character in the range 0 to 127

Synopsis:

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

Description:

The isascii() function tests for a character in the range from 0 to 127.

The __isascii() function is identical to isascii(). Use __isascii() for ANSI naming conventions.

Returns:

A non-zero value is returned when the character is in the range 0 to 127; otherwise, zero is returned.

See also:

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

Examples:

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

char chars[] = {'A', 0x80, 'Z'};

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

void main()
  {
    int   i;

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

produces the output:

Char A is an ASCII character
Char   is not an ASCII character
Char Z is an ASCII character

Classification:

WATCOM

__isascii() conforms to ANSI naming conventions.

Systems:

All (except DOS/PM)