C
CeyloR
Hello everyone,
I just started with the language C and it's very interesting.
I bought the book 'The C Programming Language' from Brian W. Kernighan
and Dennis M. Ritchie.
While reading something about arrays in C, there was something not
clear to me.
In an example they use an array to count digits from some input. When
they refer to the array the code looks like:
++ndigit[c-'0'];
where c is the current character beeing read from the input (as
integer).
Am I right that the [c-'0'] stands for the convertion of the character
to it's integer value?
Any help is welcome.
I just started with the language C and it's very interesting.
I bought the book 'The C Programming Language' from Brian W. Kernighan
and Dennis M. Ritchie.
While reading something about arrays in C, there was something not
clear to me.
In an example they use an array to count digits from some input. When
they refer to the array the code looks like:
++ndigit[c-'0'];
where c is the current character beeing read from the input (as
integer).
Am I right that the [c-'0'] stands for the convertion of the character
to it's integer value?
Any help is welcome.