Displaying printable characters : Printf « Console « C / ANSI-C






Displaying printable characters

Displaying printable characters
#include <stdio.h>
#include <ctype.h>

void main() {
  int i = 0;  /* Loop counter         */
  
  char ch = 0;
  
  for(i = 0 ; i<128 ; i++) {
    ch = (char)i;
    if( ch % 2 == 0)
      printf("\n");
    printf("  %4d    %c",ch,(isgraph(ch) ? ch : ' '));
  }
  printf("\n");
}

 

           
       








Related examples in the same category

1.Displaying printable characters plus whitspace namesDisplaying printable characters plus whitspace names
2.Demonstrates printing the results of simple equations
3.printf usage
4.Prints 3 characters forward and backward to demonstrate character printingPrints 3 characters forward and backward to demonstrate character printing
5.Return value from printf