Listing 4 Illustrates pointer conversions

/* convert.c: char * and pointer casts */
#include <stdio.h>

main()
{
   int n;
   int i = 7;
   char *cp = (char*) &i;

   printf("The integer at %p == %04X\n",&i,i);
   for (n = 0; n < sizeof i; ++n)
      printf("The byte at %p == %02X\n",cp+n,*(cp+n));
   return 0;
}

/* OUTPUT:
 * The integer at FFF4 == 0007
 * The byte at FFF4 == 07
 * The byte at FFF5 == 00 */

/* End of File */