title: Why does this code segfault on 64-bit architecture but work fine on 32-bit?
body: <p>I came across the following C puzzle:</p>
  
  <p>Q: Why does the following program segfault on IA-64, but work fine on IA-32?</p>
  
  <pre><code>  int main()
    {
        int* p;
        p = (int*)malloc(sizeof(int));
        *p = 10;
        return 0;
    }
  </code></pre>
  
  <p>I know that the size of <code>int</code> on a 64 bit machine may not be the same as the size of a pointer (<code>int</code> could be 32 bits and pointer could be 64 bits). But I am not sure how this relates to the above program.
  Any ideas?</p>