0

Why the output is 9? And runs only one time !

I really don't understand why output came this this ! https://code.sololearn.com/c7AoY6Cp9t1C/?ref=app

23rd Dec 2018, 6:15 AM
Vijay Sapkal
Vijay Sapkal - avatar
1 Answer
+ 2
So first the size of char. You can check this by using sizeof(char), it shown 1 byte. 1 byte consist of 8bit and max value of 8 bit is 11111111 which 255. So here you already assign c to its max value, so what happen. It'll overflow and start again from its minimum value which is 0. You can imagine 255 in place of -1 here, just right before 0. So 255+10 is kinda same as (-1)+10 = 9
23rd Dec 2018, 7:47 AM
Taste
Taste - avatar