title: Type casting char pointer to integer pointer
body: <p>So I saw a few example on how the endianness of an architecture could be found. Let's say we have an integer pointer that points to an int data type. And let's say the int value is 0x010A0B12. In a little endian architecture, the least significant byte, i.e, 12, will be stored in the lowest memory address, right? So the lowest byte in a 4-byte integer will be 12.</p>
  
  <p>Now, on to the check. If we declare a char pointer p, and type cast the integer pointer to a char * and store it in p, and print the dereferenced value of p, we will get a clue on the endianness of the architecture. If it's 12, we're little endian; 01 signifies big endian. This sounds really neat...</p>
  
  <pre><code>int a = 0x010A0B12;
  int *i = &amp;a;
  char *p = (char*)i; 
  printf("%d",*p); // prints the decimal equivalent of 12h!
  </code></pre>
  
  <p>Couple of questions here, really. Since pointers are strongly typed, shouldn't a character pointer strictly point to a char data type? And what's up with printing with %d? Shouldn't we rather print with %c, for character?</p>