title: Why does printf with %lld return a different number than with %16x when using 64 bit (long long)?
body: <p>I am accessing memory on a FPGA from a HPS running Linux and I stumbled upon a problem.</p>
  
  <pre><code>    {
          long long address_debug = *(shared_memory + i);
          printf("index: %i - value: %16x \n", i, address_debug);
      }
  </code></pre>
  
  <p>returns the values that I expect in a hexadecimal format, whereas</p>
  
  <pre><code>
      for (i = 0; i &lt; 700; i++)
      {
          long long address_debug = *(shared_memory + i);
  
              printf("index: %i - value: %lld \n", i, address_debug);
      }
  </code></pre>
  
  <p>returns values that are shifted 32 bit to the left. I get correct results with: </p>
  
  <pre><code>printf("index: %i - value: %lld \n", i, address_debug&gt;&gt;31);
  </code></pre>
  
  <p>or</p>
  
  <pre><code>printf("index: %i - value: %llu \n", i, address_debug&gt;&gt;31);
  </code></pre>
  
  <p>I am confused, as the variable itself has the same value, what am I missing?</p>