Question PRG-CPP-0011
MediumWhat is the output of this program?
#include <iostream>
using namespace std;
void swapRef(int &a, int &b) { int t = a; a = b; b = t; }
int main() {
int x = 1, y = 2;
swapRef(x, y);
cout << x << " " << y;
return 0;
}
- A.
1 2
- B.
2 1
- C.
Sign up free to see the answer and a step-by-step explanation.