const

What Are the 32 Keywords in C?

C has 32 reserved keywords in the original C89 standard, such as int, if and return. Here is the full list, grouped by purpose, plus later additions.

On this page
  1. The short answer
  2. The full list
  3. Keywords added in later C standards
  4. Keywords can’t be used as names
  5. C++ reserves more words
  6. Where const fits
  7. Check it yourself

The short answer

The original C standard, C89 (also called C90), reserves 32 keywords. A keyword is a word with a fixed meaning in the language. You can’t use one as the name of a variable, function, or type. Later versions of C added more, which the last section covers.

The full list

The 32 keywords, grouped by what they’re used for:

  • Data types: char, double, float, int, long, short, signed, unsigned, void
  • Type qualifiers: const and volatile. const marks a value as read-only. volatile tells the compiler a value may change outside the program’s control, such as a hardware register.
  • Storage classes: auto, extern, register, static, typedef. static keeps a local variable’s value between calls and limits a name to its file. extern declares a name defined elsewhere. typedef gives an existing type a new name. register is only a hint to the compiler, and auto is the default for local variables, so you rarely write it.
  • Control flow: break, case, continue, default, do, else, for, goto, if, return, switch, while
  • Structured types: enum, struct, union
  • Operator: sizeof, which gives the size of a type or object in bytes

Count the groups and you get 9 + 2 + 5 + 12 + 3 + 1, which is 32.

Keywords added in later C standards

C99 added five keywords: inline, restrict, _Bool, _Complex and _Imaginary. That brings the total to 37. C11 added seven more: _Alignas, _Alignof, _Atomic, _Generic, _Noreturn, _Static_assert and _Thread_local, for a total of 44. Newer standards may add more again, so check the standard for the version you’re targeting.

Keywords can’t be used as names

A keyword has a fixed meaning, so the compiler rejects it as an identifier:

int return = 5;  // Error: return is a keyword
int class = 5;   // Valid in C, but class is a keyword in C++

The second line is a useful trap. The word class is an ordinary name in C, so code that uses it compiles there, but the same code fails as C++.

C++ reserves more words

C++ has a longer list that includes class, template, namespace, bool and new. If you’re moving from C to C++, check the C++ list too. For the C++ side of this question, see what are C++ keywords?

Where const fits

const is one of the two type qualifiers in the list. It’s the one you’ll use most often in everyday code, and the rules for it are covered in the c const keyword guide.

Check it yourself

Try compiling a small C file that uses a keyword as a name, such as int switch = 1;. The compiler rejects it because switch is a reserved word. Trying a few of these yourself is a quick way to remember the list.

The complete guide to const

The const Keyword in C++
Read the guide

Keep exploring

Guides from other topics

All topics →

Is C++ Harder Than Python?

For most beginners, C++ is harder than Python because it needs a compiler, explicit types and careful memory handling. See why, with a side-by-side example.

C++ vs Python 4 min read