banner
cells

cells

为美好的世界献上 code

Q305

Q305#

#include <iostream>

void print(int x, int y) {
    std::cout << x << y;
}

int main() {
    int i = 0;
    print(++i, ++i);
}

Answer#

click to see answer The program is unspecified / implementation defined

Explain#

print(++i, ++i) modifies i twice between two sequence points, the C++ standard does not specify the order of evaluation of function arguments, so the evaluation order of ++i can be arbitrary, the specific output depends on the compiler and optimization settings.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.