C Keywords

C Keywords – Complete Beginner Guide
If you want to write correct, efficient, and professional programs in C programming language, you must clearly understand C keywords.
In this fully rewritten, SEO-optimized, beginner-friendly guide, you’ll learn everything about C keywords in a simple and structured way—perfect for students, beginners, and exam preparation.
What Are Keywords in C?
Keywords in C are reserved words that have a predefined meaning in the language.
These words are reserved by the compiler, so you cannot use them as variable names, function names, or identifiers.
Example:
1 | int age = 20; |
Here:
int→ keywordage→ variable20→ value
Why Keywords Cannot Be Used as Identifiers?
Keywords are building blocks of the C language.
Each keyword tells the compiler what to do.
If keywords were allowed as identifiers, the compiler would get confused.
Invalid example:
1 | int int = 10; // ERROR |
How Many Keywords Are There in C?
According to the ANSI C standard (C89 / C90), there are:
32 Keywords in C
All keywords are written in lowercase letters.
Complete List of C Keywords (With Categories)
For easy understanding, C keywords are grouped by function and purpose.
Data Type Keywords
These keywords define what type of data a variable can store.
| Keyword | Description |
|---|---|
int | Integer data type |
char | Character data type |
float | Decimal (single precision) |
double | Decimal (double precision) |
void | No value / empty |
short | Short integer |
long | Long integer |
signed | Allows negative values |
unsigned | Only positive values |
Example:
1 2 3 | int age = 25; float salary = 45000.50; char grade = 'A'; |
Control Flow Keywords (Decision Making)
These keywords control decision-making logic in a program.
| Keyword | Purpose |
|---|---|
if | Executes code if condition is true |
else | Executes if condition is false |
switch | Multi-condition branching |
case | Case inside switch |
default | Executes when no case matches |
Example:
1 2 3 4 5 6 7 8 | if (age >= 18) { printf("Adult"); } else { printf("Minor"); } |
Looping Keywords (Iteration)
Used to execute a block of code multiple times.
| Keyword | Description |
|---|---|
for | Loop with known count |
while | Loop while condition is true |
do | Executes at least once |
break | Exits loop |
continue | Skips current iteration |
Example:
1 2 3 4 | for (int i = 1; i <= 5; i++) { printf("%d ", i); } |
Storage Class Keywords
These keywords define scope, lifetime, and visibility of variables.
| Keyword | Meaning |
|---|---|
auto | Default local variable |
static | Retains value between calls |
extern | Declares global variable |
register | Suggests CPU register storage |
Example:
1 | static int count = 0; |
Function-Related Keywords
Used to define functions and return values.
| Keyword | Use |
|---|---|
return | Returns value from function |
void | Function returns nothing |
Example:
1 2 3 4 | int add(int a, int b) { return a + b; } |
Jump Control Keywords
These keywords change the normal flow of execution.
| Keyword | Description |
|---|---|
break | Exit loop or switch |
continue | Skip iteration |
goto | Jump to label |
goto is rarely recommended.
Example:
1 2 3 4 5 | if (x == 0) goto end; end: printf("Done"); |
Type Conversion & Size Keywords
Used for type-related operations.
| Keyword | Purpose |
|---|---|
sizeof | Returns memory size |
typedef | Creates alias |
const | Makes variable constant |
volatile | Prevents optimization |
Example:
1 2 | const int MAX = 100; printf("%lu", sizeof(int)); |
Structure & Union Keywords
Used to create custom data types.
| Keyword | Description |
|---|---|
struct | Collection of variables |
union | Shared memory |
enum | Named constants |
Example:
1 2 3 4 5 | struct Student { int id; char name[20]; }; |
Complete List of All 32 C Keywords
1 2 3 4 5 6 7 8 | auto break case char const continue default do double else enum extern float for goto if int long register return short signed sizeof static struct switch typedef union unsigned void volatile while |
Common Beginner Mistakes with C Keywords
- Using keyword as variable name
- Writing keywords in uppercase
- Confusing keywords with functions
- Misusing
staticandextern Overusinggoto
Best Practices for Using C Keywords
- Always write keywords in lowercase
- Understand purpose before use
- Avoid unnecessary keywords
- Prefer structured programming
- Learn keywords by category
Keywords vs Identifiers (Quick Comparison)
| Feature | Keywords | Identifiers |
|---|---|---|
| Reserved | Yes | No |
| Predefined | Yes | User-defined |
| Meaning | Fixed | Custom |
| Example | int, if | age, sum |
Real-World Example
1 2 3 4 5 6 7 8 9 10 11 12 | #include <stdio.h> int main() { int price = 100; float tax = 0.18; float total = price + (price * tax); printf("Total: %.2f", total); return 0; } |
Keywords used:
intfloatreturn
Frequently Asked Questions (FAQs)
1. How many keyword are there in C?
There are 32 keyword in standard C.
2. Can keyword change in future versions?
Standard C keeps keyword stable, but newer versions (C99, C11) add features—not many new keyword.
3. Are keyword case-sensitive?
Yes. All keywords must be written in lowercase.
4. Is printf a keyword?
No. printf is a library function, not a keyword.
5. Why is goto discouraged?
It makes programs harder to read and maintain.
Why Learning C Keyword Is Important
Understanding keyword helps you:
Read programs easily
Write error-free code
Crack exams and interviews
Learn advanced concepts
Build strong fundamentals
Keyword are the grammar of C language.
Final Thoughts
C keyword are:
Limited in number
Powerful in meaning
Essential for every program
If you master keyword, you automatically improve your:
Syntax knowledge
Logical thinking
Programming confidence
Once you understand C keyword clearly, you’re ready to move on to:
- Variables
- Operators
- Control Statements
- Functions
- Pointers
