You are viewing a single comment's thread. Return to all comments →
Why u substracted with 48???
https://stackoverflow.com/questions/439573/how-to-convert-a-single-char-into-an-int There is a comment in top answer that states that -48 woun't work on every encoding. There is another aspect - your question. Would you have a question if the code was: arr[i][j] - '0' ...? Probably not. In my opinion the use of -48 falls into bad practice. And note: because both operands are subtracted the subtraction itself is obsolete.
he has taken the array as string and so for comparing numbers he subtracted the array with ascii value of number '0' i.e. 48 which will give the number directly during comparison.