title: format cout for pointer
body: <p>I want to convert these c code to c++ code . It is about pointer printf</p>
  
  <pre><code>int n = 44;
  //printf("n   = %d \t &amp;n = %x\n", n, &amp;n);
  cout&lt;&lt;"n ="&lt;&lt;n&lt;&lt; "\t" &lt;&lt;"&amp;n ="&lt;&lt;hex&lt;&lt;int(&amp;n)&lt;&lt;endl;
  </code></pre>
  
  <p>When I run the printf output is like that:</p>
  
  <pre><code>   n=44   &amp;n=22ff1c
  </code></pre>
  
  <p>But when I run the cout output is like that:</p>
  
  <pre><code>   n=44 &amp;n=22ff0c
  </code></pre>
  
  <p>Why do the two versions output different values for the address of n?</p>