Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(b) (10 marks) The following programming model contains in its code memory the indicated C program composed of 2 functions. You must show how the

image text in transcribed

(b) (10 marks) The following programming model contains in its code memory the indicated C program composed of 2 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 Z, s,4, 10 name 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 n1- 31.236; n2 28 , 445 ; n3 - 35.78 n4-24.3 varianceomputeVarianoe4 (nl, n2, n3, n4) printf ( "The four values are : . 2, . 2, . 2, 8. 2f ", nl, , n3, n4) printf ("The varianae of the 4 values is 2f ", variance) double computeVariance4 (double nl, double n2, double n3, double n4) double variance double avg avg-nl n2n3 n4; avg-avg/4.0 variance (navg) *(nl -avg) variance-variance (n2 - avg)*(n2avg); variance-variance (n3 - avg)* (n3 avg) variance variance + (ni -avg)(navg); variance-variance/4.0 return (variance) Console

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database 101

Authors: Guy Kawasaki

1st Edition

0938151525, 978-0938151524

More Books

Students also viewed these Databases questions