Kindly tell me the logic behind 2 statement which are in bold
Actually i am not able to got u.
If you need to know the meaning of these lines then find below:
if(c>='0' && c<='9') Here, we are checking, whether enetred input is between 0 and 9;
Here input is index of array (ndig);
if entered input is between 0 and 9 then in statement ++ndig[c-'0'], we are going to the particular
index of array using this [c-'0'] (index of array is input entered by user) and incresing the value of array of particular index by one.Suppose user is entered 1, this value is greater than o and less than 9.So conpiler will execute statement ++ndig[c-'0'], in this statement compiler will find the index of array through statement c-'0', in this statement c is enetered digit, eneterd digit is 1 in chat this will be 49, '0' means 48, if we minus the 48 from 49 then result will be one. In this way compiler will go the first index of array (ndig) and increment the value of that index by one.
|All times are GMT +5.5. The time now is 14:05.|