title: %X format specifier to represent an integer
body: <p>I've been taking a look a Zed A. Shaw's "Learn C the hard way" tutorials. One of his extra credit questions <em>(in exercise 9)</em> requested me to represent a <code>char[4]</code> as an <code>int</code>.</p>
  
  <p>After scouting around I came over a SO question that was about the same thing and therefore managed to come up with the answer:</p>
  
  <pre><code>int i;
  int intName = 0;
  
  for(i = 0; i &lt; 4; i++){
      intName = intName + name[i];
  }
  
  printf("intName: %d\n", intName);
  printf("intName: %X\n", intName);
  </code></pre>
  
  <hr>
  
  <p>Output:</p>
  
  <pre><code>intName: 291
  intName: 123
  </code></pre>
  
  <hr>
  
  <p>The name at hand was, "Zed", I calculated the ASCII decimal values and they did indeed add up to 291, which is fine. However after searching I couldn't find any explanation as to why <code>%X</code> would return 123.</p>
  
  <p>In this scenario, what does this format specifier do? It would be awesome if I were to get somewhat of a detailed answer as to what's going on. Learning C seems far more in-depth and I feel I should completely understand these basics such as these before moving on to anything else.</p>