title: Which guarantees does malloc make about memory alignment?
body: <p>I came across the following code:</p>
  
  <pre><code>int main()
  {
      char *A=(char *)malloc(20);
      char *B=(char *)malloc(10);
      char *C=(char *)malloc(10);
      printf("\n%d",A);
      printf("\t%d",B);
      printf("\t%d\n",C);
      return 0;
  }  
  //output--   152928264     152928288    152928304
  </code></pre>
  
  <p>I want to know how the allocation and padding is done by <code>malloc()</code>. Looking at the output I can see that the starting address is a multiple of 8. Arethere any other rules?</p>