Answered step by step
Verified Expert Solution
Question
1 Approved Answer
(a) (10 marks) The following programming model contains in its code memory the indicated C program composed of2 functions. You must show how the working
(a) (10 marks) The following programming model contains in its code memory the indicated C program composed of2 functions. You must show how the working memory is used during the execution of the two functions. Each piece of working memory is associated to a function using a pair of lines. (Note: the first pair of lines associates the piece of working memory allocated to the function main and the second pair of lines associates the piece allocated to the function computeVariance4). Show how the given C program affects the contents of the working memory Show the values are assigned to variables. Be sure to show all values that are assigned and replaced. Record successive assignments to variables/parameters as follows Variable name 2, A, 10 Using arrows show how values are copied between the working memory allocated to the function main and the working memory allocated to the function computeNetResistance In the console window show the output of the program. Code Memory Working Memory include // Function prototype double computeVariance4 (double, double, double, double) void main ) double nl double n2 double n3 double n4; double variance nl-31.236; n2 28.445 n3 35.78; n4 24.3 variance-aomputeVariance4 (nl, n2, n3, n4) printf ("The four values are : %.2f, *.2f, 2f, 8.2f ". nl, n2, n3, n4) printf ("The variance of the 4 values is 8.2f ", variance) double computeVarianoe4 (double nl, double n2, double n3, double n4) double variance: double avg avg nl n23 n4: avg avg/4.0; variance(nl-avg)(ni avg); variance- variance (n2avg)*2avg) variance - variance (n3 - avg)(n3 avg) variance variance (n4 -avg)*(n4 - avg) variance variance/4.0 return (variance) Console
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