0
Output of C++ code
Can someone explain the output of this code? https://code.sololearn.com/cpokwoCQR1Zv/#cpp
3 Respostas
+ 2
`char` data range spans from -128 up to 127, when `++c` is executed, <c> value wraps to -128 which is less than 128 (loop condition), so basically, the loop is infinite because the limit is never reached.
+ 3
Out of range. Last number of char in ASCII table is 127, but ++c in your loop make char c = 128 so it is out of type's range.
When you condition is c < 127 it make last value of c = 127.
+ 2
@Ipang
Yeah, so I do something like this
for (char c=0; c<128; ++c){cout << (int) c << endl;}
and I see what you describe, strange, but true. Thank you
Thank you @Derlas Forenly