0
Find the output?
main() { int i=0; cout<<i++; cout<<++i; }
2 Respostas
+ 6
Usually i would be initialized to 0, so the output would be 02. But it can depend on the compiler. Heres more info
https://stackoverflow.com/questions/30172416/uninitialized-variable-behaviour-in-c
+ 1
To add: Historically, ++i would take greater preference over a call or operation, whereas i++ does not. Though it may be compiler dependent, it should be "02". But these things are why we always use parenthesis.