+ 3
Can someone breakdown what happens in this code cuz i'm a little confused here
#include <iostream> using namespace std; int main(){ int i = 0; i = ++i + ++i; cout << i; // outputs 4 return 0; }
2 Réponses
+ 5
https://code.sololearn.com/c41753l2UDU3/?ref=app
i =0;//default
i = ++i + ++i // i preincremented by 1 twice due to this ++i
i = 2 + 2// so now after adding i twice it becomes 4
i = 4//
+ 4
hey thanku somuch yeah and it shoud output 4 my mistake @Lord Krishna