Nearby lessons
8 of 72C - Keywords
Keywords are the words C has already claimed for itself — int, if, for, return and 28 others. They have a fixed meaning and cannot be used as your own variable or function names. This lesson places keywords among the five kinds of token, lists all 32 grouped by purpose, and clears up the most common confusion: main is not one of them.
What are Keywords?
A keyword is a word that C has already reserved for a special meaning. For example int means integer type, if means decision, and return means send a value back.
Keywords are also always lowercase. C is case-sensitive, so int is the keyword but INT and Int are not — they are just ordinary names you could use as your own.
The 32 Standard Keywords
ANSI C (C89) defines exactly 32 keywords. Grouped by what they are for, they are much easier to remember than one long alphabetical list:
| Category | Count | Keywords |
|---|---|---|
| Data types | 5 | int char float double void |
| Type modifiers | 4 | signed unsigned short long |
| Type qualifiers | 2 | const volatile |
| Storage classes | 4 | auto register static extern |
| Control flow | 11 | if else switch case default break continue for while do goto |
| User-defined types | 4 | struct union enum typedef |
| Others | 2 | return sizeof |
| Total | 32 |
inline and restrict in C99, _Bool, _Static_assert and others in C11 — so a modern compiler knows more than 32. If a question does not name a standard, answer 32.
- Keywords are words with a fixed meaning reserved by C
- They cannot be used as variable or function names
- ANSI C (C89) has exactly 32 keywords; later standards added a few more
- main is NOT a keyword — it is an identifier
- C is case-sensitive — INT is not the keyword int