campus placement TCS Test Series Programming and Data Structure Programming in C Scope of a Variable
Consider the following C function
void swap ( int x, int y )
{
int tmp;
tmp = x;
x= y;
y = tmp;
}
In order to exchange the values of two variables a and b:
1
Call swap (a, b)
2
Call swap (&a, &b)
3
swap(a, b) cannot be used as it does not return any value
4
swap(a, b) cannot be used as the parameters passed by value