home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0000 - 0009 / ibm0000-0009 / ibm0003.tar / ibm0003 / LCNOW2.ZIP / EXAMPLES / CHARS.C < prev    next >
Encoding:
C/C++ Source or Header  |  1988-07-06  |  497 b   |  24 lines

  1. /*
  2.  * C H A R S
  3.  *
  4.  * Show how to print characters and show the relationship
  5.  * between characters to their internal codes.
  6.  */
  7.  
  8. main()
  9. {
  10.     /* Declare variables. */
  11.     char ch;
  12.     int code;
  13.  
  14.     /* Initialize variables. */
  15.     ch = 'A';
  16.     code = 48;
  17.  
  18.     /* Print the codes and characters. */
  19.     printf("Our PCs use the ASCII character set.\n");
  20.     printf("The ASCII code for the letter %c is %d.\n", ch, ch);
  21.     printf("The ASCII code %d represents the character %c.\n",
  22.            code, code);
  23. }
  24.