Module 7 · Functions, Scope and Storage Classes
Storage Classes: auto, static, extern, register
Free with an accountReading
Kenji is building a quiz game. Each time a round starts, the game should announce its number: round 1, round 2, round 3.
Checking what this lesson needs for you…
What is inside Storage Classes: auto, static, extern, register
- Kenji's counter forgets
- static: a local that survives the call
- Initialised once, before main starts, to 0 by default
- The three questions, one table
- static on a global: private to its file
- extern: defined in another file
- register and auto: two words you will not write