Mega Code Archive

 
Categories / C / Code Snippets
 

Displaying printable characters

#include <stdio.h> #include <ctype.h> void main() { int j = 0; /* Loop counter */ char ch = 0; for(j = 0 ; j<128 ; j++) { ch = (char)j; if( ch % 2 == 0) printf("\n"); printf(" %4d %c",ch,(isgraph(ch) ? ch : ' ')); } printf("\n"); }