mercredi 13 juillet 2016

Why is priority of round brackets ignored


Consider the following code snippet: #include <iostream> using namespace std; int main() { int x = 10; std::cout << (x++) << std::endl; return 0; } I expect the x++ to be equivalent to ++x as the expression is enclosed by round brackets. And accordingly expect 11 to be printed, but the output is 10. Why?

Aucun commentaire:

Enregistrer un commentaire