what s 5bi 5d 270 27 does

Solutions on MaxInterview for what s 5bi 5d 270 27 does by the best coders in the world

showing results for - "what s 5bi 5d 270 27 does"
Cristina
14 Jan 2020
1It seems that s is a character array or a pointer to the first 
2element of a character array. And element s[i] contains a character
3that represents a digit as for example '5' . To convert this character
4that for example in ASCII has internal code equal to 53 
5(while internal code of character '0' is 48) there is used expression
6
7s[i] -'0'
8that is equivalent to
9
1053 - 48
11and equal to number 5
Anas
22 Jan 2019
1    '0' - 48
2    '1' - 49
3    '2' - 50
4    '3' - 51
5    '4' - 52
6    '5' - 53
7    '6' - 54
8    '7' - 55
9    '8' - 56
10    '9' - 57