0
Why this "for statement“ executed without any error?
when " z" did not initialize how it could compare with "x" in "for statement". I think it is possible a garbage value assigned to z when it did not initialize and this compare does not work correctly. https://code.sololearn.com/cqN0BW45C193/?ref=app
4 Respuestas
+ 3
Accessing z is undefined behavior, since it wasn't initialized.
Different compilers may have different initialization values for that case.
The last value which is saved on stack will be returned as first value of z.
+ 3
Thinking about it, my answer was misleading (aka wrong). Sorry
+ 1
You said "then the loop is executed...". I think in " do while() ;" first code execute then survey condition, but in "while and for" first survey condition and after that excute body of them.
0
So Can I say this statement is unstable?