HOME HTML EDITOR C JAVA PHP

C Keywords:

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.

1. Categorized List of Keywords

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

2. Important and Frequently Used Keywords

The typedef Keyword

Used to create an alias for an existing data type. This is often used with structures to make code more readable.

typedef unsigned long ulong;
ulong distance = 10000;

The volatile Keyword

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).

The sizeOf Operator

Although it looks like a function, sizeof is actually a keyword that returns the size (in bytes) of a data type or variable.

printf("Size of int: %zu bytes", sizeof(int));

3. Keyword Rules to Remember

4. Technical Evolution

The number of keywords has grown as the C standard evolved:

Pro Tip: Modern IDEs and text editors will usually "Syntax Highlight" keywords in a different color (often blue or purple). If your variable name changes color, it’s a sign you should choose a different name!