← Quiz: Storage Classes in C: all 15 questions
Quiz: Storage Classes in C · Question 9 of 15
Where do static and global variables live in memory?
Where do static and global variables live in memory?
- A.On the stack
- B.On the heap
- C.In the data segment (or BSS if not initialised)
- D.In CPU registers
Answer & explanation
Correct answer: In the data segment (or BSS if not initialised)
They exist for the whole run, so they are not on the stack; initialised ones go in data, zero-initialised ones in BSS.
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 →