CJCoding With Joseph
15free / daySign inCreate account
Back to Code Walkthrough

Swap Without a Temp Variable

C++ code walkthrough · Question 43
hardOperators

Code

Read carefully. What does this print?
1#include <iostream>
2using namespace std;
3int main() {
4 int a = 5, b = 8;
5 a = a + b;
6 b = a - b;
7 a = a - b;
8 cout << a << " " << b << endl;
9 return 0;
10}

Your answer