title: c casting pointer of type int* to char* and then accessing the value
body: <p>Could somebody explain why the output value of this code is 64? </p>
  
  <p><code>&amp;a</code> gets the address of a, it yields a pointer of type <code>int*</code>. This pointer of type <code>int*</code> is then cast to a pointer of type <code>char*</code>. Then you access the value at the address stored in <code>ptr</code>. </p>
  
  <p>I know it is related to <code>sizeof(char) == 1</code>, but I just can't quite see how the output is 64. </p>
  
  <pre><code>#include&lt;stdio.h&gt;
  int main(){
  
     int a = 320;
     char *ptr;
     ptr =( char *)&amp;a;
  
     printf("%d ",*ptr);
  
     return 0;
  }
  </code></pre>