← Quiz: Storage Classes in C: all 15 questions
Quiz: Storage Classes in C · Question 2 of 15
What is the difference between scope and lifetime?
What is the difference between scope and lifetime?
- A.They are two names for the same thing
- B.Scope is about memory; lifetime is about the name
- C.Scope is where the name can be used; lifetime is how long the memory exists
- D.Scope applies only to globals; lifetime only to locals
Answer & explanation
Correct answer: Scope is where the name can be used; lifetime is how long the memory exists
A static local shows the difference: its name works only inside the function, but its memory lives for the whole program.
Can you get the rest right without peeking?
Take the timed Quiz: Storage Classes in C quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →