title: C++ function memory alignment
body: <p>I have read something like that before but unfortunately, forgot some details.</p>
  
  <p>Please, explain function memory alignment:</p>
  
  <pre><code>int f(int a = 3, int b = 5) {
      int c = 7;
  
      int *p = &amp;c;
  
      std::cout &lt;&lt; "Pointer value: " &lt;&lt; *p &lt;&lt; "\tPointer address: " &lt;&lt; p  &lt;&lt; std::endl;
      --p;
      std::cout &lt;&lt; "Pointer value: " &lt;&lt; *p &lt;&lt; "\tPointer address: " &lt;&lt; p  &lt;&lt; std::endl;
      --p;
      std::cout &lt;&lt; "Pointer value: " &lt;&lt; *p &lt;&lt; "\tPointer address: " &lt;&lt; p  &lt;&lt; std::endl;
      --p;
      std::cout &lt;&lt; "Pointer value: " &lt;&lt; *p &lt;&lt; "\tPointer address: " &lt;&lt; p  &lt;&lt; std::endl;
      --p;
      std::cout &lt;&lt; "Pointer value: " &lt;&lt; *p &lt;&lt; "\tPointer address: " &lt;&lt; p  &lt;&lt; std::endl;
      --p;
      std::cout &lt;&lt; "Pointer value: " &lt;&lt; *p &lt;&lt; "\tPointer address: " &lt;&lt; p  &lt;&lt; std::endl;
  
      std::cout &lt;&lt; "A address: " &lt;&lt; &amp;a  &lt;&lt; std::endl;
      std::cout &lt;&lt; "B address: " &lt;&lt; &amp;b  &lt;&lt; std::endl;
  
      return c;
  }
  </code></pre>
  
  <p>Produces output:</p>
  
  <pre><code>Pointer value: 7        Pointer address: 0x7ffd62ee8dcc
  Pointer value: 6299840  Pointer address: 0x7ffd62ee8dc8
  Pointer value: 32748    Pointer address: 0x7ffd62ee8dc4
  Pointer value: -2112316480      Pointer address: 0x7ffd62ee8dc0
  Pointer value: 3        Pointer address: 0x7ffd62ee8dbc
  Pointer value: 5        Pointer address: 0x7ffd62ee8db8
  Actual A address: 0x7ffd62ee8dbc
  Actual B address: 0x7ffd62ee8db8
  </code></pre>
  
  <p>What is located between function arguments and first object on the stack?</p>