C Keywords
Meaning of Keywords
In C language, keywords are built-in commands with predefined purposes that instruct the compiler on how to interpret specific segments of code. They serve specific internal functions and are not available for use as custom variable names or identifiers.
These system-defined terms carry pre-assigned meaning and are recognized instantly by the compiler during code translation.
Important Traits
- Non-modifiable: Cannot be redefined by the user
- Precompiled: Understood without manual linking
- Syntax-essential: Act as building blocks for control, declaration, storage, and flow
Classification of Keywords
1. Flow Control Words
Enable conditional actions or repetition.
- If,else - direct code flow based on condition outcomes.
- switch, case, default – alternative path selection
- while, for, do – repetition mechanisms
- break, continue – alter loop execution
- goto – jump to labeled locations
2. Storage and Data Declaration
Define memory behavior and variable lifetimes.
- auto, register – temporary and quick-access memory
- static, extern – persistent and external scope
- const, volatile – fixed or dynamic nature
- sizeof – determine memory footprint of data
3. Data Type Specifiers
Define the type of data a variable is capable of holding.
- int, float, char, double – numeric or character data
- short, long – adjust storage size
- signed, unsigned – manage positive/negative constraints
- _Bool, _Complex, _Imaginary – specialized modern types
4. Function and Block Indicators
Mark segments of logic or define actions.
- return – send value back from a function
- void – indicate no value
- main – primary entry point
- inline – suggest code inlining
5. Type Definition and Casting
Create aliases or manipulate types.
- typedef – assign new names to types
- enum, struct, union – user-defined complex types
6. Scope Management & Code Modifiers
Control visibility and safety of data access.
- Static – Confines a variable or function's scope to the file or function it's defined in, preventing external access.
- extern – point to external data
- restrict – optimize pointer access
Basic Examples
int number = 10;
const float PI = 3.14;
if (number > 5) {
return 1;
} else {
return 0;
} In this sample:
- int, const, float, if, else, and return are predefined keywords recognized by the compiler for specific functionalities.
Number of Standard Keywords
As per the C99 standard:
There are 32 core keywords, but C11 and later revisions introduced a few more, especially for atomic operations, threading, and other modern needs.
Naming Caution
These terms must never be used as:
- Variable labels
- Function identifiers
- Structure tags
Quick List of Common Keywords
| Keyword | Role |
|---|---|
| int | Declares whole-number type |
| void | Specifies no return value |
| for | Begins a loop |
| while | Repeats until false |
| switch | Selects among cases |
| return | Ends function and outputs |
| struct | Groups related variables |
| typedef | Renames types |
| static | Holds memory in scope |
| extern | Refers to external storage |
| break | Exits loop or case |
| goto | Jumps to a label |
Final Thoughts
C keywords act as hard-coded instructions. Understanding their distinct purposes is vital for anyone aiming to master low-level control over programs.
They’re small in number, but huge in importance—like chess pieces, their power depends on how and where you use them.
Prefer Learning by Watching?
Watch these YouTube tutorials to understand C Tutorial visually:
What You'll Learn:
- 📌 C_09 Keywords and Identifiers | Programming in C
- 📌 C Constants Variables and Keywords | Brief Explanation for Beginners