Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. (5 points) Consider the following function. integer fun(var k: integer) // k is an integer and passed by reference begin k:=k + 5; return
1. (5 points) Consider the following function. integer fun(var k: integer) // k is an integer and passed by reference begin k:=k + 5; return (4 * k) - 1; end Suppose fun is used in the following program segment (stub): i:=8; suml :=(i * 4) + fun(i); j=6; sum2 := fun(j) + ( * 4); Note that var means the parameterk is passed by reference (i.e., its address is passed to the function). a. What are the values of suml and sum2, if the operands in the expressions to determine suml and sum2 are evaluated from left to right? b. What are the values of suml and sum2, if the operands in the expressions to determine suml and sum2 are evaluated from right to left
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started