in Programming in C
502 views
0 votes
0 votes

 

in Programming in C
502 views

2 Comments

Is it B?
0
0
Yeah it's b
0
0

1 Answer

0 votes
0 votes
In call by name, parameter is evaluated when it is used, not when the function is called. Hence every time in function P, a,b and c will refer to y,x and x respectively. However x is a local variable of P so x in function P will be value of 3.

In line b = b+x+6, b will refer to global variable x that will be equal to 5+3+6 = 14

In the next line c = c+a, again the value of global variable x will be equal to 14+10 = 24

So, finally value of x has become 24, whereas the value of y remains as it is that is 10.