Table of Contents

isprint

    int isprint(int chr);

tests if character is printable

C Sourcecode Example

#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 ( isprint(string[i]) != 0 )
      {
       printf("Character %i is printable char\n",i);
      }
    }
  return 0;
}

output

  cd@najai:~$ ./isprint 
  Character 0 is printable char
  Character 1 is printable char
  Character 2 is printable char
  Character 3 is printable char
  Character 4 is printable char
  Character 5 is printable char
  Character 6 is printable char
  Character 7 is printable char
  Character 8 is printable char
  Character 9 is printable char