GATE 2010 CSE Q. NO. 11
1 2 3 4 5 6 7 8 9 10 11 | #include<stdio.h> void f(int *p,int *q){ p=q; *p=2; } int i=0,j=1; int main(){ f(&i,&j); printf("%d %d\n",i,j); return 0; } |
(A) 2 2 (B) 2 1 (C) 0 1 (D) 0 2 Explaination : In main function we are passing the address of i and j in function f() and collecting the addresses in pointer variable p and q respectively. Now we are assigning the content of q to the p So *p=2 will … Read more