C Keywords Reference

C keywords are reserved words that have special meaning in the language. You cannot use them as variable names, function names, structure member names, or other identifiers.

This reference groups common C keywords by purpose so you can recognize what each one does when reading code.

Classic C Keywords

The original core of C uses keywords for data types, control flow, storage, and declarations. These are the words you will see most often in beginner and everyday C programs.

Category Keywords Purpose
Basic types char, double, float, int, long, short, signed, unsigned, void Describe the kind and size of data.
Control flow break, case, continue, default, do, else, for, goto, if, return, switch, while Choose which statements run and how loops behave.
Storage class auto, extern, register, static Control linkage, lifetime, and storage hints.
Type building enum, struct, typedef, union Create or name custom data types.
Qualifiers and operators const, sizeof, volatile Add rules to objects or ask about object size.

Example: Keywords Working Together

This program uses several keywords together: enum for named status values, typedef and struct for a custom type, static for a helper function, and switch with case labels for selection.

#include <stdio.h>

/* enum, typedef, struct, const, static, switch, case, break, default, and return are keywords. */
enum Status {
    STATUS_READY = 1,
    STATUS_DONE = 2
};

typedef struct {
    const char *title;
    enum Status status;
} Task;

static void print_task(Task task)
{
    switch (task.status) {
        case STATUS_READY:
            printf("%s: ready\n", task.title);
            break;
        case STATUS_DONE:
            printf("%s: done\n", task.title);
            break;
        default:
            printf("%s: unknown\n", task.title);
            break;
    }
}

int main(void)
{
    Task first = {"Write notes", STATUS_READY};
    Task second = {"Review code", STATUS_DONE};

    print_task(first);
    print_task(second);

    return 0;
}

Output:

Write notes: ready
Review code: done

The keyword decides the grammar role. For example, struct starts a structure type, while return exits a function and gives a value back to the caller.

Later Standard Keywords

Newer C standards added more reserved keywords. You do not need all of them for beginner programs, but you may see them in modern headers or systems code.

Standard Keywords Common use
C99 inline, restrict, _Bool, _Complex, _Imaginary Function optimization hints, pointer aliasing promises, Boolean and complex number support.
C11 _Alignas, _Alignof, _Atomic, _Generic, _Noreturn, _Static_assert, _Thread_local Alignment, atomic operations, generic selection, compile-time checks, and thread-local storage.

Some compilers also support extra words as extensions. When writing portable C, prefer standard keywords and check your compiler settings.

Example: Loop And Size Keywords

The next example uses unsigned, sizeof, for, if, continue, and return. Notice that keywords are part of the syntax, while names such as values, count, and total are identifiers chosen by the programmer.

#include <stdio.h>

int main(void)
{
    unsigned int values[] = {1, 2, 3, 4};
    int total = 0;
    unsigned int count = sizeof values / sizeof values[0];

    for (unsigned int i = 0; i < count; i++) {
        if (values[i] == 2) {
            continue;
        }
        total += values[i];
    }

    printf("total: %d\n", total);
    return 0;
}

Output:

total: 8

Keywords Are Not Identifiers

Because keywords are reserved, this is not allowed: using int as a variable name, or using return as a function name. Choose descriptive identifiers such as score, total, print_task, or max_items instead.

C is also case-sensitive. The keyword int is reserved, but Int is a different identifier. Even so, avoid names that only differ by capitalization because they are easy to misread.

Quick Tips

  • Use keywords exactly as C defines them; do not redefine them with macros or identifiers.
  • Expect keywords to appear in declarations, loops, conditionals, and type definitions.
  • When a word changes how code is parsed, it is probably a keyword or an operator.
  • Prefer clear identifier names that do not resemble reserved words.

The key idea is that keywords are the fixed vocabulary of C, while identifiers are the names you create to describe your program’s data and behavior.