C++ Interview Question 6 Answer

Bjarne-stroustrup
 

Answer

This question is compilable and deterministic.

Its output is “012012”.

Explanation

Whether you post-increment or pre-increment i, its value does not change until after the loop body has executed.

SOURCE

Subscribe to TFE Times

Enter your email address to become a member of TFE Times today!