Why is 0 = 48 in this code? [solved] | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Why is 0 = 48 in this code? [solved]

Here is my code: https://code.sololearn.com/cQr93C76D80K/#cpp I don't know why, but when using kas.at() string function, when it's 0 code shows 48, 1 is 49 and so on. Could somebody help me with that?

3rd Apr 2019, 4:41 AM
MajaW
MajaW - avatar
4 Answers
+ 5
I think "at" means "Ascii Table"🤔
4th Apr 2019, 1:36 AM
Flandre Scarlet
Flandre Scarlet - avatar
+ 2
Well, quick search on the forum and I found that ASCII character of 0 is represented by 48, 1 by 49 and so on ;D
3rd Apr 2019, 4:43 AM
MajaW
MajaW - avatar
0
ascii value of 0 is 48
4th Apr 2019, 11:51 AM
Imran Khan
Imran Khan - avatar
0
'0' is a character data type not an integer, represent a value of 48 in integer.
5th Apr 2019, 5:47 AM
Edison
Edison - avatar