title: Using snprintf to print restricted hex value
body: <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  
  main()
  {
      char buff[255];
      snprintf(buff, 255, "%02x", 0xFFFFFF);
      printf("%s\n", buff);
  }
  </code></pre>
  
  <p>I am expecting the above code to print <code>ff</code>(since I gave %02x) but the op is <code>fffff</code>. What am i doing wrong?</p>