Answer each of the following questions with auto, extern, register, and//or stat
ID: 3829830 • Letter: A
Question
Answer each of the following questions with auto, extern, register, and//or static. a) Which storage class is used primarily to indicate that a variable or function be shared by several files? b) Suppose that a variable x is to be shared by several functions in one file but hidden from functions in other files. Which storage class should x be declared have? c) Which storage classes can affect the storage duration of a variable? Given function f o o () below: int foo (int i) {static int j = 0; return i * j + +;} a) What will be the value of foo (10) if foo () has never been called before? b) What will be the value of foot (10) if foo () has been called five times previously?Explanation / Answer
1)
a)
extend
b)
static
c)
auto, register
d)
2)
a)
foo(10) = 10*0 = 0 (now j value will be 1 after first call)
b)
foo(10) = 10*1 = 10 (now j value will be 2 after second call))
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.