What is the value printed by the following pseudocode progra
What is the value printed by the following pseudo-code program for each of the four parameter passing modes call-by-value, call-by-reference, call-by-value/result, and call-by-name? That is, for each of the four parameter passing modes assume that both the x and y parameters use that mode. Show how each program is evaluated in that mode and show the final value printed:
Solution
starting from the main program a is assigned with value 2 and then in the next line a value is passed as a parameter to function p and then p function is called by value and now the p function executes with both parameters as value of 2.
now in p function x=x+1 means x value is 3 and a=y means a value is 2 and the result is passed to main program and write_integer(a) executes and prints the value 2.
