C isgraph () - C Standard Library

De functie isgraph () controleert of een teken een grafisch teken is of niet.

Tekens met een grafische weergave zijn bekend, zijn grafische tekens.

De isgraph () controleert of een karakter een grafisch karakter is of niet. Als het argument dat wordt doorgegeven aan isgraph () een grafisch teken is, retourneert het een geheel getal dat niet gelijk is aan nul. Als dit niet het geval is, wordt 0 geretourneerd.

Deze functie wordt gedefinieerd in Header File "> ctype.h header-bestand

Functieprototype van isgraph ()

 int isgraph (int argument);

De functie isgraph () accepteert één argument en retourneert een geheel getal.

Wanneer karakter wordt doorgegeven als argument, wordt de corresponderende ASCII-waarde van het karakter doorgegeven in plaats van dat karakter zelf.

Voorbeeld 1: controleer het grafische teken

 #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); 

Uitvoer

 Wanneer wordt doorgegeven aan isgraph () = 0 Wanneer wordt doorgegeven aan isgraph () = 0 Wanneer 9 wordt doorgegeven aan isgraph () = 1

Voorbeeld 2: druk alle grafische tekens af

 #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; ) 

Uitvoer

Alle grafische karakters in C-programmering zijn:! "# $% & '() * +, -. / 0 1 2 3 4 5 6 7 8 9:;? @ ABCDEFGHIJKLMNOPQRSTU VWXYZ () _` abcdefghijklmnopqrstu vwxyz (|) ~

Interessante artikelen...