In call by name: In general, the effect of pass-by-name is to textually substitute the argument expressions in a Procedure call for the corresponding parameters in the body of the procedure.
Technically, if any of the Variables in the called procedure clash with the caller's variables, they must be renamed uniquely before substitution.
Now consider the following code:
global int i = 100, j = 5;
int i = 10;
print(x + 10);
i = 200;
j = 20;
P(i + j);
- Will the variable I declared in function P get renamed before execution ?
- Which I (global or local) is accessed by x in print(x + 10)?
- Which I (global or local) will get updated by (i = 200)?
- What will be the output of the second print statement (220 or 120)?
Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
This Question have been answered