#include <ctype.h>
|
int
isprint (int c); |
For single character representations, the value of the argument is representable as an unsigned char or the value of EOF.
The functionality of this API is independent of the program’s current locale and so it returns non-zero for all the characters (of various locales supported) that belong to the class print(see defns for definition), irrespective of the locale they belong to.
#include<ctype.h> //isprint() #include<stdio.h> //printf() int test_isprint() { int arr[]={’n’,’\f’, 0xe1, ’6’, ’ ’}; int i = 0; int size = 5; for( i=0; i<size; i++) { int ret = isprint(arr[i]); //call to the API with the chars in arr[] if( (!ret) != 0 ) { printf("\n%c is not printable char ", arr[i]); } else { printf("\n%c is printable char", arr[i]); } } printf("\n"); }
Output
n is printable char is not printable char á is not printable char 6 is printable char is printable char
© 2005-2007 Nokia |