int c, int ndigit[10]; ++ndigit[c-'0'];

for example c-'0' is an integer expression with a value between 0
and 9 corresponding to the character '0' to '9' stored in c, and thus a valid subscript for the array ndigit

原文地址:https://www.cnblogs.com/wjshan0808/p/3329654.html