The answer file for this exercise is lab09.
Please refer to the code from lab exercise lab08, found in ~p6720/exercises/refs_functions. The main program call_f.cc calls the subprogram f. The arguments in the calling statement match the arguments in the definition of the subprogram. When the call is made, the subprogram variables are initialized (get their initial values) with values coming from the main program.
In your answer file write the equivalent declarations of the
subprogram variables x, y_ptr, dydx including initialization
(initial assignments) for the call f(x,&y,dydx);. Here is the
answer for the first argument:
double x /*in subprogram f*/ = x /*from main program*/ ;
(Note that we chose to enclose comments here in /* */). Give the
answer for the second and third arguments. You need only three lines
for the whole answer.
For more details and an example, please see the section "Subprogram Linkage" in the online notes referenced above. In your answer be careful to distinguish variable names that have scope only in the subprogram from names that have scope only in the calling program.
Suppose later in the main program the function was called using f(sqrt(5*x), &ysq5x, dydxsq5x) . Write the equivalent declarations with initialization for this case.