C examples for Language Basics:printf
Character Output in printf function
#include <stdio.h> #include <limits.h> // For CHAR_MAX #include <ctype.h> // For isprint() int main(void){ int count = 0;/* ww w.j a v a 2 s . c o m*/ printf("The printable characters are the following:\n"); // Iterate over all values of type char for(int code = 0 ; code <= CHAR_MAX ; ++code){ char ch = (char)code; if(isprint(ch)) { if(count++ % 32 == 0) printf("\n"); printf(" %c", ch); } } printf("\n"); return 0; }