// cast_test.c - demonstration of explicit typecasting

#include <stdio.h>
#include <stdlib.h>

int main()
{
  int a_number = 0;
  unsigned count = 0;
  unsigned char *help = NULL;

      // now we want to access all single bytes of the
      // int-value separately to find out about the
      // byte order of the machine that we run on
  help = ((unsigned char*)&a_number) + sizeof(int);
  count = sizeof(int);
  while(count--)
    *--help = (unsigned char)(count | 0xf0);

      // let's have a look, how the bytes are ordered
  printf("%x\n",a_number);
  return(0);
}
