Keywords in C programming with examples से समझना हर नए programmer के लिए बेहद ज़रूरी है, क्योंकि ये बुनियादी Word हैं जिनके बिना C language में एक भी meaningful program नहीं लिखा जा सकता। जब आप पहली बार C सीखना शुरू करते हैं, तो सबसे पहले आपका सामना इन्हीं reserved words से होता है, जैसे int, if, while, return — और इन्हें सही तरीके से जानना आपकी coding journey को मज़बूत नींव पर खड़ा करता है।
इस blog post में हम C language के सभी 32 keywords को विस्तार से समझेंगे, उनकी categories जानेंगे, और हर important keyword के real code examples देखेंगे। साथ ही यह भी जानेंगे कि keywords और identifiers में क्या फर्क है, और programming करते समय किन common गलतियों से बचना चाहिए।
चाहे आप किसी university exam की तैयारी कर रहे हों, किसी interview के लिए C revise कर रहे हों, या बिल्कुल scratch से C programming सीख रहे हों — यह guide आपके लिए एक complete reference की तरह काम करेगी। अंत तक पढ़ें और C keywords पर अपनी पकड़ पक्की करें।
Table of Contents
C Programming में Keywords क्या होते हैं?
Keywords in C programming वो predefined, reserved words होते हैं जिनका अर्थ compiler के लिए पहले से तय होता है। इन्हें आप variable name, function name या किसी भी identifier के रूप में use नहीं कर सकते। C language में कुल 32 keywords होते हैं, जो ANSI C standard के अनुसार define किए गए हैं।
सरल भाषा में कहें तो — जैसे Hindi भाषा में कुछ शब्दों का अपना fixed meaning होता है, वैसे ही C compiler के लिए इन keywords का meaning fixed होता है। अगर आपने int नाम का variable बनाने की कोशिश की, तो compiler error देगा, क्योंकि int एक reserved keyword है।
Keywords की मुख्य विशेषताएं
- ये हमेशा lowercase में लिखे जाते हैं।
- इन्हें variable, function या array के नाम के रूप में use नहीं किया जा सकता।
- हर keyword का compiler के लिए एक specific purpose होता है।
- ये C language की syntax और structure का हिस्सा हैं।
C के सभी 32 Keywords की सूची
नीचे ANSI C के सभी 32 keywords दिए गए हैं:
| Data Types | Control Flow | Storage Class | Others |
|---|---|---|---|
| int | if | auto | return |
| float | else | register | sizeof |
| double | switch | static | typedef |
| char | case | extern | struct |
| void | for | union | |
| short | while | enum | |
| long | do | const | |
| signed | break | volatile | |
| unsigned | continue | ||
| goto | |||
| default |

Categories के अनुसार Keywords in C Programming with Examples
1. Data Type Keywords
ये keywords variables के data type को define करते हैं — यानी बताते हैं कि variable में किस प्रकार का data store होगा।
int — Integer Data Type
Integer Data Type Program Code:
#include <stdio.h>
int main() {
int age = 21; // Store age
printf("Age: %d\n", age);
return 0;
}
int keyword पूर्णांक (whole number) values store करने के लिए use होता है।
float और double — Decimal Numbers
Float Data Type Program Code:
#include <stdio.h>
int main() {
float price = 99.99f; // Floating-point value
double pi = 3.14159265358979; // Double-precision floating-point value
printf("Price: %.2f\n", price);
printf("Pi: %lf\n", pi);
return 0;
}
char — Character Data Type
Char Data Type Program Code:
#include <stdio.h>
int main() {
char grade = 'A'; // Store a character
printf("Grade: %c\n", grade);
return 0;
}
void — No Value
void keyword का use तब होता है जब function कोई value return नहीं करता।
Void Data type Program Code:
#include <stdio.h>
// Function to display a greeting message
void greet() {
printf("Good Morning, C Programmer!\n");
}
int main() {
// Call the function
greet();
return 0;
}
2. Control Flow Keywords
ये keywords program के execution flow को control करते हैं।
if, else — Conditional Statements
If else Program Code:
#include <stdio.h>
int main() {
int marks = 75; // Store the student's marks
// Check whether the student has passed or failed
if (marks >= 60) {
printf("Pass\n");
} else {
printf("Fail\n");
}
return 0;
}
switch, case, default — Multiple Conditions
Switch case Program Code:
#include <stdio.h>
int main() {
int day = 2; // Store the day number
// Display the day name based on the day number
switch (day) {
case 1:
printf("Monday\n");
break;
case 2:
printf("Tuesday\n");
break;
default:
printf("Some other day\n");
}
return 0;
}
for Loop — Counted Repetition
For Loop Program Code:
#include <stdio.h>
int main() {
// Print numbers from 1 to 5
for (int i = 1; i <= 5; i++) {
printf("Count: %d\n", i);
}
return 0;
}
while और do-while — Condition-Based Loops
While Program Code:
#include <stdio.h>
int main() {
int n = 1; // Initialize the while loop counter
// While loop
while (n <= 3) {
printf("n = %d\n", n);
n++;
}
// Do-while loop
int x = 0;
do {
printf("do-while: x = %d\n", x);
x++;
} while (x < 3);
return 0;
}
break और continue
Break And Continue Program Code:
#include <stdio.h>
int main() {
// Loop from 0 to 9
for (int i = 0; i < 10; i++) {
// Exit the loop when i becomes 5
if (i == 5) {
break;
}
// Skip the value 3
if (i == 3) {
continue;
}
printf("%d ", i);
}
return 0;
}
goto — Unconditional Jump
Goto Statement Program Code:
#include <stdio.h>
int main() {
int i = 0; // Initialize the counter
start:
// Print the current value of i
printf("%d\n", i);
i++;
// Jump back to the label while i is less than 3
if (i < 3) {
goto start;
}
return 0;
}
Note: goto का use आजकल avoid किया जाता है क्योंकि इससे code पढ़ना कठिन हो जाता है।
3. Storage Class Keywords
ये keywords बताते हैं कि variable कहाँ और कितने समय तक store रहेगा।
auto — यह default storage class है। Local variables automatically auto होते हैं।
static — Variable की value function call के बाद भी बनी रहती है।
Static Variable Program Code:
#include <stdio.h>
// Function with a static variable
void counter() {
static int count = 0; // Retains its value between function calls
count++;
printf("Count: %d\n", count);
}
int main() {
// Call the function three times
counter();
counter();
counter();
return 0;
}
extern — दूसरी file में define हुए variable को access करने के लिए।
register — Variable को CPU register में store करने की request करता है, जिससे access तेज़ होती है।
register int i;
for(i = 0; i < 1000000; i++) { /* fast loop */ }
4. Other Important Keywords
return — Value वापस करना
int add(int a, int b) {
return a + b; // result return karo
}
sizeof — किसी Data type या function का Size जानना
sizeof() Program Code:
#include <stdio.h>
int main() {
// Display the size of different data types
printf("Size of int: %zu bytes\n", sizeof(int));
printf("Size of float: %zu bytes\n", sizeof(float));
printf("Size of char: %zu bytes\n", sizeof(char));
return 0;
}
struct — User-defined Data Type
Struct Data Type Program Code:
#include <stdio.h>
// Structure to store student information
struct Student {
char name[50]; // Student name
int roll; // Roll number
float marks; // Marks
};
int main() {
// Initialize a structure variable
struct Student s1 = {"Rahul", 101, 89.5f};
printf("Name: %s\n", s1.name);
printf("Roll Number: %d\n", s1.roll);
return 0;
}
typedef — नया नाम देना
typedef unsigned long int ULONG;
ULONG bigNumber = 4000000000;
const — Value को Lock करना
const float PI = 3.14;
// PI = 3.15; // Error! const variable change nahi hota
enum — Named Integer Constants
Enum Data Type Program Code:
#include <stdio.h>
// Enumeration for seasons
enum Season {
Spring,
Summer,
Autumn,
Winter
};
int main() {
// Assign an enum value
enum Season s = Summer;
printf("Season value: %d\n", s);
return 0;
}
Keywords Vs Identifiers — क्या फर्क है?
यह एक बहुत common confusion है। Keywords predefined होते हैं और compiler इन्हें पहचानता है, जबकि identifiers वो names हैं जो programmer खुद define करता है (जैसे variable names, function names)।
| Keywords | Identifiers |
|---|---|
| Predefined होते हैं | Programmer define करता है |
| Lowercase में होते हैं | Upper/lowercase दोनों हो सकते हैं |
| Meaning fixed है | Meaning programmer तय करता है |
| Example: int, for | Example: myAge, calculateSum |
सबसे ज़रूरी नियम: Identifier को keyword के नाम पर नहीं बनाया जा सकता।
int float = 5; // Error — float एक keyword है
int myFloat = 5; // Correct
Common Mistakes जो Beginners करते हैं
1. Keywords को Capital Letters में लिखना
Int age = 20; // Error
int age = 20; // Correct
2. Keyword को Variable Name बनाना
int return = 10; // Error
int result = 10; // Correct
3. break को Loop के बाहर Use करना
int main() {
break; // Error — loop या switch के बाहर break नहीं चलता
return 0;
}
Conclusion ( निष्कर्ष )
Keywords in C programming with examples को समझ लेना आपकी C programming की नींव को पूरी तरह मज़बूत कर देता है। इस पूरे blog में हमने 32 keywords की categories, उनके real code examples, keywords और identifiers का फर्क, और common mistakes — सब कुछ विस्तार से cover किया। अब आप जानते हैं कि static variable क्यों अपनी value याद रखता है, const क्यों lock होता है, और volatile embedded systems में क्यों ज़रूरी है।
अगर आप सच में C programming में expert बनना चाहते हैं, तो सिर्फ पढ़ने से काम नहीं चलेगा — हर keyword का code खुद type करें, experiment करें, और errors से सीखें। इस article को bookmark करें ताकि future में reference के तौर पर काम आए, और नीचे comment करके बताएं कि कौन सा keyword आपको सबसे confusing लगा। अपने coding दोस्तों के साथ share ज़रूर करें!
