What is the result of the following program?
program side-effect (input, output);
var x, result: integer;
function f (var x:integer:integer;
I tried to run this program in pascal but it is showing fatal error.
how will call by reference work here?
Answer is (d) :
Why? Since in question syntax is like pascal we will assume that this segment follows rules of Pascal programming language. Then , there is rule in pascal that if in declaration of formal parameters keyword 'var' is prefixed , then the procedure follows call by reference and modifies the actual values of actual params. So the answer is 42.