You asked how the below expression works
c-'0'
The ASCII code of the entered charecter is subtracted from the ASCII code of 0 and it defines the position in the array where the count has to be stored .
Suppose you enter 1 from the keyboard ASCII code for 1 is 49 and ASCII code for 0 is 48. hence
49-48 =1
and the count will be stored in the array index location 1 .