Quiz: Storage Classes
Quiz: Storage Classes checks how well you can apply static local retention and extern linkage (and related ideas) in C.
Introduction
Quiz: Storage Classes checks how well you can apply static local retention and extern linkage (and related ideas) in C. Try each prompt in a scratch file before moving on.
Understanding the topic
Challenge 1 In your own words — or with a tiny program — show that you understand: static local retention.
Challenge 2 In your own words — or with a tiny program — show that you understand: extern linkage.
Challenge 3 In your own words — or with a tiny program — show that you understand: auto default for locals.
Challenge 4 In your own words — or with a tiny program — show that you understand: register hint.
- Challenge 1 — In your own words — or with a tiny program — show that you understand: static local retention.
- Challenge 2 — In your own words — or with a tiny program — show that you understand: extern linkage.
- Challenge 3 — In your own words — or with a tiny program — show that you understand: auto default for locals.
- Challenge 4 — In your own words — or with a tiny program — show that you understand: register hint.
Step-by-step explanation
- Challenge 1 — In your own words — or with a tiny program — show that you understand: static local retention.
- Challenge 2 — In your own words — or with a tiny program — show that you understand: extern linkage.
- Challenge 3 — In your own words — or with a tiny program — show that you understand: auto default for locals.
- Challenge 4 — In your own words — or with a tiny program — show that you understand: register hint.
Execution workflow
Challenge 1
In your own words — or with a tiny program — show that you understand: static local retention.
Best practices
- Enable warnings: gcc -Wall -Wextra -std=c11 source.c -o app
- Give every variable a defined value before it is read.
- Stay inside array bounds — C will not stop you from over-running a buffer.
Common mistakes
- Reading uninitialized storage — behavior is undefined.
- Dismissing compiler warnings instead of fixing root causes.
- Ignoring NULL returns from malloc, fopen, and similar APIs.
Hands-on exercise
Practice problems:
- Build or explain: static local retention
- Build or explain: extern linkage
- Build or explain: auto default for locals
- Build or explain: register hint
Summary
Quiz: Storage Classes in C — Self-check on static and extern behavior.