What is the output? void swap(int a, int b) {
What is the output?
void swap(int a, int b) {
int t = a; a = b; b = t;
}
int x = 1, y = 2;
swap(x, y);
printf("%d %d", x, y);
Show answerHide answer
Correct answer: (D) 1 2
Explanation
Call by value swaps only the local copies.