0
How many times will the following loop run?
for(char c=0; c<266; ++c) {}
3 Respostas
+ 2
Infinitely. ASCII table has 128 characters (they hold values between 0 and 127).
Maximum value (127) + 1 gives a minimum value, so 266 won't be reached.
+ 2
it is an infinite loop
this is known as overflow of signed char
check this for more infos:
https://www.geeksforgeeks.org/what-happens-if-loop-runs-till-maximum-of-signed-and-unsigned-in-c/
+ 2
sorry, ignore my previous answer. i didn't pay close attention and didn't see that it wasn't an int.