0
Isn't this a end loop due to int limit overflow
for( int i =0; i >= 0; i++)
2 Antworten
+ 13
Technically, yes. The loop will end when i overflows and becomes a negative value. Compiling and running this on desktop shows that it takes around 8 seconds for this to happen. Code Playground may timeout before that.
+ 9
yes , it's end with overflow where the condition is being false with negative i value
integer type max value is 2,147,483,647 in 32-bit signed equal to (2^31)-1
and after overflow it's become -2,147,483,648