title: how to find out if a variable is signed or unsingned
body: <p>In C program, if an integer is <code>signed integer</code>, then the highest bit is <code>1</code>, otherwise <code>0</code>.</p>
  
  <p>Lets take <code>char</code> and <code>unsigned char</code>, the range for a <code>signed char</code> is <code>-128</code> to <code>127</code> and <code>unsigned char</code> is <code>0</code> to <code>255</code>, but in fact their hexadecimal are in range of <code>0x00</code> to <code>0xff</code>.
  My question is now if a <code>char</code> and <code>unsigned char</code> are stored in memory using 8 bits binary number, how does the computer itself know whether it is <code>signed</code> or <code>unsigned</code>?</p>
  
  <pre><code>char a = 0xff; printf("%d", a); //its result is -1.
  unsigned char a = 0xff; printf("%d", a); //its result is 255.
  </code></pre>
  
  <p>In the example above, how does <code>printf</code> know the value of <code>0xff</code> is signed or unsigned? Is that only depends on the definition of <code>a</code>?</p>