Keywords are reserved words in C that have a predefined meaning to the compiler. Because they are part of the language's syntax, they cannot be used as identifiers (variable names, function names, etc.). C89/C90 started with 32 keywords, and subsequent standards (C99, C11) have added a few more.
To make them easier to remember, we can group keywords by their functionality:
| Category | Keywords |
|---|---|
| Data Types | int, char, float, double, void, _Bool, _Complex |
| Control Flow | if, else, switch, case, default, goto |
| Loops | for, while, do, break, continue |
| Storage Classes | auto, static, extern, register |
| Structures/Unions | struct, union, enum, typedef |
| Type Qualifiers | const, volatile, restrict, inline |
Used to create an alias for an existing data type. This is often used with structures to make code more readable.
Informs the compiler that a variable's value may change at any time without any action being taken by the code the compiler finds nearby (useful for hardware sensors or multi-threading).
Although it looks like a function, sizeof is actually a keyword that returns the size (in bytes) of a data type or variable.
INT or If are not keywords; they would be treated as regular identifiers.long double are two separate words but work together as a single type definition.int float; because both words are reserved.The number of keywords has grown as the C standard evolved:
inline, restrict, and _Bool)._Thread_local and _Atomic).