Keywords
Keywords are reserved words with special meaning — int, return, if, while, struct, etc.
Introduction
Keywords are reserved words with special meaning — int, return, if, while, struct, etc. They cannot be used as identifiers.
Understanding the topic
C11 keywords auto, break, case, char, const, continue, default, do, double, else, enum, extern, float, for, goto, if, inline, int, long, register, return, short, signed, sizeof, static, struct, switch, typedef, union, unsigned, void, volatile, while
C11 extended keywords _Alignas, _Alignof, _Atomic, _Bool, _Complex, _Generic, _Imaginary, _Noreturn, _Static_assert, _Thread_local
- C11 keywords — auto, break, case, char, const, continue, default, do, double, else, enum, extern, float, for, goto, if, inline, int, long, register, return, short, signed, sizeof, static, struct, switch, typedef, union, unsigned, void, volatile, while.
- C11 extended keywords — _Alignas, _Alignof, _Atomic, _Bool, _Complex, _Generic, _Imaginary, _Noreturn, _Static_assert, _Thread_local.
Step-by-step explanation
- C11 keywords — auto, break, case, char, const, continue, default, do, double, else, enum, extern, float, for, goto, if, inline, int, long, register, return, short, signed, sizeof, static, struct, switch, typedef, union, unsigned, void, volatile, while.
- C11 extended keywords — _Alignas, _Alignof, _Atomic, _Bool, _Complex, _Generic, _Imaginary, _Noreturn, _Static_assert, _Thread_local.
Execution workflow
C11 keywords
auto, break, case, char, const, continue, default, do, double, else, enum, extern, float, for, goto, if, inline, int, long, register, return, short, signed, sizeof, static, struct, switch, typedef, union, unsigned, void, volatile, while.
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:
- Identify keywords in a sample program
- Explain why void is a keyword
Summary
Keywords in C — Reserved words the language claims — they cannot be reused as names.