GATE | GATE-CS-2004 | Question 2
Consider the following C function
void swap ( int a, int b)
{
int temp;
temp = a;
a = b;
b = temp;
}
|
In order to exchange the values of two variables x and y.
(A) Call swap (x, y)
(B) Call swap (&x, &y)
(C) swap(x,y) cannot be used as it does not return any value
(D) swap(x,y) cannot be used as the parameters are passed by value
Answer: (D)
Explanation: See question 3 of https://www.geeksforgeeks.org/c-language-set-2/
Quiz of this Question
Last Updated :
28 Jun, 2021
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...