title: What is the format specifier for unsigned short int?
body: <p>I have the following program </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main(void)
  {
      unsigned short int length = 10; 
  
      printf("Enter length : ");
      scanf("%u", &amp;length);
  
      printf("value is %u \n", length);
  
      return 0;
  }
  </code></pre>
  
  <p>Which when compiled using <code>gcc filename.c</code> issued the following warning (in the <code>scanf()</code> line). </p>
  
  <p><code>warning: format ‘%u’ expects argument of type ‘unsigned int *’, but argument 2 has type ‘short unsigned int *’ [-Wformat]</code></p>
  
  <p>I then referred the <code>C99 specification - 7.19.6 Formatted input/output functions</code> and couldn't understand the correct format specifier when using the length modifiers (like <code>short</code>, <code>long</code>, etc) with <code>unsigned</code> for <code>int</code> data type.</p>
  
  <p>Is <code>%u</code> the correct specifier <code>unsigned short int</code>? If so why am I getting the above mentioned warning?! </p>
  
  <p>EDIT: 
  Most of the time, I was trying <code>%uh</code> and it was still giving the warning. </p>