Gate CS-2004 Question Paper With Solutions

Q. 72 Consider the following C function

void swap(int a, int b)  
{       
    int temp;
    temp = a;
    a = b;
    b = temp;  
}

In the 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: (A)

Explanation:

Gate CS-2004 Question Paper With Solutions

Learn More:   Gate CS-2018 Question Paper With Solutions

LEAVE A REPLY

Please enter your comment!
Please enter your name here