C isgraph () - Bibliothèque standard C

La fonction isgraph () vérifie si un caractère est un caractère graphique ou non.

Les caractères qui ont une représentation graphique sont connus sont des caractères graphiques.

L'isgraph () vérifie si un caractère est un caractère graphique ou non. Si l'argument passé à isgraph () est un caractère graphique, il renvoie un entier différent de zéro. Sinon, il renvoie 0.

Cette fonction est définie dans le fichier d'en-tête "> fichier d'en-tête ctype.h

Prototype de fonction de isgraph ()

 int isgraph (argument int);

La fonction isgraph () prend un seul argument et renvoie un entier.

Lorsque le caractère est passé comme argument, la valeur ASCII correspondante du caractère est transmise à la place de ce caractère lui-même.

Exemple # 1: vérifier le caractère graphique

 #include #include int main() ( char c; int result; c = ' '; result = isgraph(c); printf("When %c is passed to isgraph() = %d", c, result); c = ''; result = isgraph(c); printf("When %c is passed to isgraph() = %d", c, result); c = '9'; result = isgraph(c); printf("When %c is passed to isgraph() = %d", c, result); 

Production

 Quand est passé à isgraph () = 0 Quand est passé à isgraph () = 0 Quand 9 est passé à isgraph () = 1

Exemple # 2: imprimer tous les caractères graphiques

 #include #include int main() ( int i; printf("All graphic characters in C programming are: "); for (i=0;i<=127;++i) ( if (isgraph(i)!=0) printf("%c ",i); ) return 0; ) 

Production

Tous les caractères graphiques de la programmation C sont:! "# $% & '() * +, -. / 0 1 2 3 4 5 6 7 8 9:;? @ ABCDEFGHIJKLMNOPQRSTU VWXYZ () _` abcdefghijklmnopqrstu vwxyz (|) ~

Articles intéressants...