Name

isascii - character classification routines

Library

libc.lib

Synopsis

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

Return values

The function returns non-zero if ’c’ is ASCII character, zero otherwise.

Detailed description

The isascii function tests if ’c’ is an ASCII character, which is any character between 0 and octal 0177 inclusive.

Examples

#include<ctype.h> //isascii()
#include<stdio.h> //printf()
int test_isascii()
{
   int arr[]={’s’,’9’,’\r’, 128, ’\"’};
   int i = 0;
   int size = 5;
   for( i=0; i<size; i++)
   {
     int ret = isascii(arr[i]); //call to the API with chars in arr[]
     if( (!ret) != 0 )
     {
        printf("\n%d is not ascii char ", arr[i]);
     }
     else
     {
        printf("\n%c is ascii char", arr[i]);
     }
   }
printf("\n");
}

         

Output

s is ascii char
9 is ascii char
 is ascii char
128 is not ascii char
" is ascii char

         

See also

toascii, defns

Feedback

For additional information or queries on this page send feedback

© 2008-2009 Nokia Corporation. All rights reserved. This documentation can be used in the connection with this Product to help and support the user.

Top