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.

Sign in to read

This lesson is free, with an account

An account costs nothing and opens every lesson in this track that is not marked Pro, on every device you read on.

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