Gate CS-2008 Question Paper With Solutions

Q. 74 What is printed by the following C program?

int f(int x, int *py, int **ppz)			
{						                    	
    int y, z;					                		
    **ppz += 1; z = **ppz;		 // corrected z = *ppz; to z = **ppz;                
    *py += 2; y = *py;					                	
    x += 3;					                    	
    return x+y+z;
}

void main()
{
    int c, *b, **a;
    c = 4; b = &c; a = &b;
    printf("%d", f(c, b, a));
    	
}

(A) 18

(B) 19

(C) 21

(D) 22

Answer: (B)

Explanation:

Gate CS-2008 Question Paper With Solutions

Learn More:   Gate EE-2007 Question Paper With Solutions

LEAVE A REPLY

Please enter your comment!
Please enter your name here