A directory of Objective Type Questions covering all the Computer Science subjects. Here you can access and discuss Multiple choice questions and answers for various compitative exams and interviews.

Discussion Forum

Que. 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:swap(x,y) cannot be used as the parameters are passed by value
Confused About the Answer? Ask for Details Here
Know Explanation? Add it Here

Similar Questions: