C Language में Keywords और identifiers की संपूर्ण जानकारी हिंदी में

Keywords in C in Hindi - C में Keywords क्या है

C कई विभिन्न Elements से मिलकर बना है और उसमें एक महत्त्वपूर्ण Elements, Keywords है जो language के Syntax और behaviour को Define करने के लिए महत्पूर्ण भूमिका निभाता है। 

C Programming में Keywords, Reserved Words होते है जिसका अपना विशिष्ट अर्थ और कार्य होता है। 
आप Keywords का Use Variable या Function को नाम देने के लिए नहीं कर सकते क्योंकि ये पहले से Predefined (पुर्वनिर्धारित) रहते है

अगर आप C में सही और अच्छा Program लिखना चाहते है तो इन Keywords को जानना आवश्यक है

जैसे Conditional Statements Define करने के लिए 'if' Keyword Use किया जाता है वही Loop Statement बनाने के लिए 'for ' keywords का Use करते है। 

अतः प्रत्येक Keyword का अपना अलग अलग Role है जिसे जानना अत्यंत आवश्यक है

C में Keywords की सूची - List of C keywords

C में 32 Keywords की List निम्न है

C में keywords के प्रकार - Types of Keywords in Hindi

C मे keywords को कई प्रकार से वर्गीकृत किया जा सकता है जिसमे कुछ ऐसे है जो ज्यादातर Use में आते है ये निम्न है।

1) Data Types:
Variable में जिस प्रकार का Data रखा है वह उसके Data Type को Define करने के इस Category का Use करते है

जैसे Integer Data के लिए int keywords, Floating Point Number के लिए 'float' , Character Type Data के लिए 'char' आदि Use करते है

Examples
int, float, char, double, long, short, signed, unsigned आदि

2) Control Flow:
एक Program मे Execution के flow को Control करने के लिए इस Category का Use करते है इसमें flow Control Statement ( Conditional, Looping, Branching) के लिए निम्न keywords का Use करते है 

Examples
if, else, while, do, for, switch, break, goto, continue आदि
 
3) Storage Classes:
इसके अंतर्गत ऐसे keywords आते है जिसका प्रयाग कर आप Variables के Scope और Lifetime को Define कर सकते है
Examples 
auto, `extern, static, register

4) Modifiers:
इसके अंतर्गत उपस्थित keywords आपको Variables की Properties और Data Types को Modify करने की अनुमति देते है

Examples
const, volatile, typedef, signed, unsigned

5) Structures and Unions:
इसके अन्तर्गत struct और union keywords का Use करके ऐसे Data Type का निर्माण किया जा सकता है जो विभिन्न डाटा Types वाले Members को एक Unit में रखने की सुविधा देता है defined  
6) Enumeration:
इसके अंतर्गत enum keyword Use किया जाता है जिसका प्रयोग करके Integer Values को एक नाम देकर Group में रखा जाता इन Values को बदला नहीं जा सकता

7) Function Handling:
इसमें void keyword का Use होता है जिसका प्रयोग ऐसे function को Define करने में होता है जो Value Return नही करता

keywords Use करते समय कुछ बातो का ध्यान रखना

keywords C Programming का आवश्यक भाग है यदि इसका Use Program में सही तरीके से न किया जाए तो यह Programming के दौरान Error लाने का कारण भी बन जाता है इसलिए keywords Use करते समय निम्न बातों का ध्यान रखना चाहिए

1) keywords Use करते समय उसके Spelling का ध्यान रखना चाहिए यदि आपने while के स्थान पर whil लिखा तो Compilation Error का सामना करना पड़ सकता है

2) यद्यपि keywords आवश्यक है लेकिन keywords का अत्याधिक Use करने से Programming के Code को समझना कठिन हों जाता है अतः जहां जरुरत है उसी स्थान पर keywords का 

3) keywords का सही अर्थ समझे ताकि उसका प्रयोग उचित ढंग से किया जा सके 

4) keywords को Use करने से पहले जांच ले कि आपके द्वारा Use किया जानें वाला keywords Complier के अनुकूल है कि नही

5) C Language, Case Sensitive है अर्थात Lower Case और Uppercase Letters अलग है अतः keywords में उचित Case का Use करना चाहिए

Identifier in C in Hindi - C में Identifier क्या है

किसी भी variable, function, structure, arrays, pointer और अन्य Entities के नाम को Identifier कहते है 
C programming में एक identifier users के द्वारा Program की विभिन्न entities जैसे variables, functions, arrays, labels और user-defined data types को दिया गया नाम है।

Program में Identifiers को दिया गया अर्थपूर्ण नाम, Code को पढ़ने और समझने के लिए महत्वपूर्ण भूमिका निभाता है 

Examples

int age;
float price;
void add();
ऊपर age तथा price Variables के नाम है जिसे हम Identifier कहते है तथा add भी Identifier है जो कि Function का नाम है अतः सभी Variables या Functions के नाम Identifier होते है 

Rules for Naming Identifiers

identifier का नामकरण करते समय हमे कुछ निर्धारित नियमों का अनुसरण करने की जरुरत होती है जो निम्न है

1) identifier मे letters(uppercase और lowercase), Digits और Underscore शामिल होते है।

अर्थात lowercase letters(a से z तक) uppercase letters (A से Z तक) और Digits (0 से 9 तक)

2) इसका नाम हमेशा alphabet letter या Underscore(_) से शुरू होना चाहिए 

3) identifier के नाम में अन्य Special Character जैसे @,#,₹,&,*,%,© आदि की अनुमति नहीं है
4) C language, Case Sensitive है इसलिए myVar और myvar को अलग अलग identifier के रूप में माना जायेगा

5) C में 32, Reserved Words जैसे int, float, for, while, switch, break, static, extern आदि है जिसका प्रयोग आप Identifier के रूप मेंनही कर सकते

Valid Identifiers के Examples

1) totalMarks
2) my_score
3) first_name
4) lastName
5) studentName
6) mobileNumber
7) employeeSalary
8) accountBalance
9) today_date
10) FULL_SIZE

Invalid Identifiers के Examples

1) 2num           (Digit से Start है)
2) my-var   (Hyphan(-) का Use हुआ है)
3) my marks     (Space है)
4) min&max       (& चिन्ह है)
5) if      (if Reserved Word(keyword) है
6) fees*         (* चिन्ह Use हुआ है)
7) 2ndplace     (Digit से शुरू हुआ है)
8) get_marks!   (! चिन्ह यू हुआ है)
9) switch          (Reserved Word है)
10) @amount   (@ चिन्ह Use हुआ है

C language Program में identifier name का Use करना

Program for Using Identifier 
#include<stdio.h> 
    int main()
 {
// variables identifier Declared
    int first_value = 60;
    int second_value= 40;

//function Identifier is used
    int total_values = first_value + second_value;

//printing result 
    printf("The total values are : %d ", total_values);
    return 0;
}
 
Output:
The total values are : 100 

ऊपर के Program में first_value और second_value, identifier का नाम है जिसे Variables के रूप में Integer Value Store करने के लिए बनाया गया है

total_values भी एक identifier का नाम है जो एक function है जिसका कार्य दोनो Variables की Values काTotal करना है

Identifiers के नामकरण के समय कुछ बाते ध्यान रखे

1) identifier के लिए हमेशा Descriptive (वरर्णात्मक) नाम चुने जो Program मे उसके कार्य और भूमिका को स्पष्ट कर सकें
Example
int studentMarks;

2) Coding के समय एक ही तरीके से Identifier बनाए camelCase या snake_case 
का उपयोग करके
Examples
int totalMarks //This is camel Case 
int total_marks //This is snake_case

3) indentifier के लिए single letter या ज्यादा short name Use नही करना चाहिए क्योंकि ये अस्पष्ट और भ्रमित करने वाले हो सकते है
Example
float averageScore;

4) constant identifier बनाने के लिए Uppercase letters के साथ Underscore का Use करना अच्छा है ताकि आप Variables और Constants के बीच स्पष्ट अंतर हो सके
Example
float MIN_SIZE;

5) identifier का नाम ऐसा हो जिसे देखकर उसके बारे में और कार्यों की स्पष्ट जानकारी हो
Example
void calculateAverage(float marks[]);

function के नाम से ही पता चल रहा है कि यह average को निकालने के लिए Use हो रहा है

6) identifier name को Underscore से शुरू न करे जो Confusion पैदा कर सकता है

7) किसी array या Collections के लिए identifier नाम हेतु Plural name चुने जो कई Items को Represent करता है
Example
char itemsName[10];

8) कभी भी identifier name के लिए Reserved Words का प्रयोग न करें ताकि Compilation error को रोका जा सके

9) यदि आपने जिस identifier का नाम चुना है वह अस्पष्ट है लेकिन चुनना जरूरी है तो Comments देकर बताए कि आपने ये नाम क्यों चुना है

10)Variables और Functions के लिए Nouns का Use करना एक अच्छा विचार है इससे Code को Read करना सरल हो जाता है

Nouns किसी वस्तु या धारणा को दिए गए नाम के समान है अतः Nouns के रूप में identifier Use होने से Coding को Natural Language के समान समझना आसान हो जाता है 
Example
//Used variable as noun which represent student's height
int studentHeight;

11) ऐसे functions जो कोई Action या Operations को Perform कर रहा है तब उस function को नाम देने के लिए verb का Use करे ताकि आप अपनी भाषा मे verbs को समझकर उसके कार्यो को जान ले।

Example
// Used function as verb which work to get minimum Value
int getMinValue(int numbers[]);

 Related Post