Programmer's version of 2-2*2 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Programmer's version of 2-2*2

int x = 1; x += x++ + ++x; cout << x;

19th Dec 2016, 11:22 PM
00111000 00110110
00111000 00110110 - avatar
1 Answer
0
The prefix increment operator increases x before the expression so x = 2 and x = x + (x + x). then the postfix increment operator increases x by 1. x = 7
19th Dec 2016, 11:55 PM
Antek