 <p>Because <code>c</code> is a character and not an integer.</p> <p>The ASCII value of '0' is 48 so a '0' would be index 48 in the <code>n[c]</code> statement and the programmer wanted '0' to be index 0 because <code>n</code> was defined <code>n[10]</code>, so the ASCII value is converted to its integer equivalent by subtracting the code for '0' so: <code>'0' - '0' = 0</code>, <code>'1' - '0' = 1</code>, etc. The ASCII codes for '0' to '9' are 48 to 57 so the conversion is sound.</p> <p>As for why, I guess someone is counting the frequency of the digits '0' to '9' in some text.</p>