Question 9
Back to Exercise
Which statement correctly distinguishes scope from lifetime?
- A They are the same thing
- B Scope is where the name is visible; lifetime is when the storage exists Correct
- C Scope is for globals, lifetime for locals
- D Lifetime is measured in lines of code
Correct Answer: Option B
A static local has block scope but static lifetime; heap memory has no name (no scope) but lives until free(). Keeping the two ideas apart explains static locals, dangling pointers and leaks.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!