title: What's the real use of using n[c-'0']?
body: <p>I'm a novice in C and I came across the code like this :</p>
  
  <pre><code>int n[10];
  if(c&gt;='0' &amp;&amp; c&lt;='9')
  ++n[c-'0']
  </code></pre>
  
  <p>In <code>if</code> loop why we have to use single quotes around <code>0</code>, whats the use of it, why we can't define <code>0</code> as an integer straight away? And in the second line of code <code>++n[c-'0']</code>, whats the use of using array like this, in sense why we need to subtract <code>0</code>(once again why the use of single quotes in this context?) from <code>c</code> in the array index?</p>
  
  <p>If i do like this <code>n[c-'0']</code>, the result of index operation(<code>c-'0'</code>) will be an character or integer? </p>
  
  <p>Given that can anyone say me, whats the real use of such array and what are the disadvantages well?</p>
  
  <p>Thanks in advance.</p>