title: What happens when address of a long variable is store in char pointer?
body: <p>I'm trying to understand what happens when I store a pointer of different data type into char pointer. I understand everything except why these two lines:</p>
  <pre><code>…
  char *cc;
  long l;
  …
  cc = &amp;l;
  printf(&quot;\nc: %ld, cc: %u&quot;, *cc, cc);
  </code></pre>
  <p>are printing this:</p>
  <pre><code>c: 4294967211, cc: 591272048
  </code></pre>
  <p>instead of this-&gt;</p>
  <pre><code>c: 171 (0xAB), cc: 591272048?
  </code></pre>
  <p>Code:</p>
  <pre><code>#include &lt;stdio.h&gt;    
  int main()
  {
    char c = 65, *cc;
    int i = 0x12345678;
    long l = 0x12345AB;
    float f = 3.14;
  
    cc = &amp;c;
    printf(&quot;c: %c, cc: %u&quot;, *cc, cc);
    cc = &amp;i;
    printf(&quot;\nc: %d, cc: %u&quot;, *cc, cc);
    cc = &amp;l;
    printf(&quot;\nc: %ld, cc: %u&quot;, *cc, cc);
    cc = &amp;f;
    printf(&quot;\nc: %f, cc: %u&quot;, *cc, cc);
  }
  </code></pre>
  <p>Prints:</p>
  <pre><code>c: A, cc: 591272063
  c: 120, cc: 591272056
  c: 4294967211, cc: 591272048
  c: 0.000000, cc: 4294967235
  </code></pre>