Gate CS-2015-1 Question Paper With Solutions

Q. 21 The output of the following C program is __________.

void f1 (int a, int b)
{
  int c;
  c=a; a=b; b=c;
}
void f2 (int *a, int *b)
{
  int c;
  c=*a; *a=*b;*b=c;
}
int main()
{
  int a=4, b=5, c=6;
  f1(a, b);
  f2(&b, &c);
  printf (“%d”, c-a-b);
  return 0;
}

 

(A) -5

(B) -4

(C) 5

(D) 3

Answer: (A)

Explanation:

Gate CS-2015-1 Question Paper With Solutions

Learn More:   Gate EC-2006 Question Paper With Solutions

LEAVE A REPLY

Please enter your comment!
Please enter your name here