Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. What is the output from the (unedited) C program below? 5 points. f: a-15 b-30 c-35 g: a-15 b-30 c-45 main: a-15 b-30
1. What is the output from the (unedited) C program below? 5 points. f: a-15 b-30 c-35 g: a-15 b-30 c-45 main: a-15 b-30 c-35 II. Assume that C has dynamic scope (it does not) instead of static scope. What would the output be? (Do this before doing part III, but you can change your answers after doing part III). 5 points. f: a- b= g: a- b= main: a- III. Modify the C program to emulate dynamic scope. Follow these steps. 10 points. Move lines 3-5 into main(). Do not leave any global variables. Since g() references a and b but does not define them, pass them in from main(). BUT you cannot just pass the values of a and b. You must pass the addresses of a and b. Likewise, f() references a, b, c so you need to pass addresses, from g() into f(). 3. 4. Do some additional changes to make gcc happy. Make sure you use the-Wall option on gcc. 5. Verify that you got the same answers as part II above. Or update part II to match. 1. 2. IV. What is the output from your modified C program? It should match part II above. 10 points. f: a- g: a- main: a- Submit your modified C program, as well as the outputs for parts I, II and IV. You can submit the output as a text file, you can update this word doc, you can submit a pdf, etc. b= b=
Step by Step Solution
★★★★★
3.39 Rating (168 Votes )
There are 3 Steps involved in it
Step: 1
Part I The output of the unedited C program is as follows f a15 b30 c35 g a15 b30 c45 main a15 b30 c35 Explanation This is because C uses static scopi...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