home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_11_08 / 1108110b < prev    next >
Text File  |  1993-06-08  |  401b  |  21 lines

  1. /* convert.c: char * and pointer casts */
  2. #include <stdio.h>
  3.  
  4. main()
  5. {
  6.     int n;
  7.     int i = 7;
  8.     char *cp = (char *) &i;
  9.  
  10.     printf("The integer at %p == %04X\n",&i,i);
  11.     for (n = 0; n < sizeof i; ++n)
  12.         printf("The byte at %p == %02X\n",cp+n,*(cp+n));
  13.     return 0;
  14. }
  15.  
  16. /* OUTPUT:
  17.  * The integer at FFF4 == 0007
  18.  * The byte at FFF4 == 07
  19.  * The byte at FFF5 == 00 */
  20.  
  21.