Learn C Programming

Lesson 5 of 8 · Functions, Scope and Storage Classes

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

  1. Kenji's counter forgets
  2. static: a local that survives the call
  3. Initialised once, before main starts, to 0 by default
  4. The three questions, one table
  5. static on a global: private to its file
  6. extern: defined in another file
  7. register and auto: two words you will not write