CJCoding With Joseph
← Back to Question List
C++ Code Walkthrough #43

Swap Without a Temp Variable

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