title: How to print signed hexadecimal in C
body: <p>I know we can use <code>printf(&quot;%04X&quot;, value);</code> to print unsigned hexadecimal values.</p>
  <p>Is there a similar flag or a function in C that you can use to print signed hex values?</p>
  <p>Something similar like this</p>
  <pre class="lang-none prettyprint-override"><code>Binary   Hex (signed) Hex (unsigned)
  -------- ----------- --------------
  
  00000010 +0x2        0x2
  00000001 +0x1        0x1
  00000000 +0x0        0x0
  11111111 -0x1        0xFF
  11111110 -0x2        0xFE
  11111101 -0x3        0xFD
  </code></pre>