Table of Contents

isascii

    int isascii(int char);

a macro that tests if a char a ASCII char (0-127) is

C Sourcecode Example

/* 
 * isascii example code
 * http://code-reference.com/c/ctype.h/isascii 
 */
#include <stdio.h> /* including standard library */
//#include <windows.h> /* uncomment this for Windows */
 
#include <ctype.h>
 
int main ( void )
{
  int i;
  char string[11]="Test ÖÄ%1";
  for (i=0; i <= 11;i++)
    {
     if ( isascii(string[i]) != 0 )
      {
       printf("character %i isascii char\n",i);
      }
    }
  return 0;
}

output

  output:
  user@host:~$ ./isascii 
  character 0 isascii char
  character 1 isascii char
  character 2 isascii char
  character 3 isascii char
  character 4 isascii char
  character 9 isascii char
  character 10 isascii char
  character 11 isascii char