Translate

C Language Identifiers का उदाहरण | Identifiers in C example image

C Language में Identifiers क्या होते हैं? आसान भाषा में पूरी जानकारी

जब आप पहली बार C Programming सीखते हैं, तो सबसे पहले जो सवाल दिमाग में आता है – “C में variable का नाम कैसे रखा जाता है?” यहीं से Identifiers in C की शुरुआत होती है।

सोचिए, अगर इंसान का नाम न हो, तो उसे पहचानना कितना मुश्किल होगा। ठीक उसी तरह, C भाषा में पहचानकर्ता (Identifiers) हर variable, function, array और user-defined item की पहचान होते हैं।

इस C programming Hindi tutorial में हम step-by-step समझेंगे:

  • C में आइडेंटिफ़ायर क्या है
  • Identifier rules in C
  • Valid और Invalid identifiers
  • Real-life examples और code snippets
  • Exams और interviews के लिए important points

📌 Table of Contents

C में आइडेंटिफ़ायर क्या है?

Identifier ka matlab होता है – किसी चीज़ की पहचान। C Language Identifiers वे नाम होते हैं जो हम program में variables, functions, arrays या pointers को देते हैं।

Definition:

C भाषा में पहचानकर्ता (Identifiers) वे नाम होते हैं जिनका उपयोग program के different elements को पहचानने के लिए किया जाता है।

जब आप लिखते हैं:

int totalMarks;

यहाँ totalMarks एक identifier है।

Identifiers क्यों ज़रूरी हैं?

अगर C Programming में identifiers न हों, तो हर variable को number से पहचानना पड़े – जो practically impossible है।

Identifiers के फायदे:

  • Program readable बनता है
  • Debugging आसान होती है
  • Logic समझना सरल होता है
  • Team projects में confusion कम होता है

यही कारण है कि C Programming Basics में identifiers सबसे पहले पढ़ाए जाते हैं।

Identifier Rules in C (C प्रोग्रामिंग के नियम)

C language identifiers rules follow करना बहुत ज़रूरी है, नहीं तो compiler error दे देगा।

Rule 1: Alphabet या Underscore से शुरू होना चाहिए

int _count;
int marks;

Rule 2: Numbers बीच में आ सकते हैं, शुरुआत में नहीं

int mark1;   // सही
int 1mark;  // गलत

Rule 3: Special characters allowed नहीं हैं

❌ @, #, %, $ allowed नहीं

Rule 4: C Keywords को identifier नहीं बना सकते

int int;   // गलत
int float; // गलत

Rule 5: Case-Sensitive होते हैं

int total;
int Total;

दोनों अलग-अलग identifiers हैं।

Valid और Invalid Identifiers – C Programming Examples

✅ Valid Identifiers

  • sum
  • total_marks
  • studentName
  • avgScore

❌ Invalid Identifiers

  • 2marks
  • total-marks
  • float
  • student name

ये C प्रोग्रामिंग उदाहरण exams में बहुत पूछे जाते हैं।

Naming Conventions & Best Practices

Sirf rules follow करना ही काफी नहीं है। Professional programmers कुछ best practices भी अपनाते हैं।

✔ Meaningful Names रखें

int totalSalary; // अच्छा
int ts;          // confusing

✔ camelCase या snake_case का उपयोग करें

  • camelCase → studentMarks
  • snake_case → student_marks

✔ Short लेकिन clear रखें

यह habits आपको Learn C programming in Hindi journey में आगे बहुत मदद करेंगी।

Beginners द्वारा की जाने वाली Common Mistakes

  • Keyword को identifier बनाना
  • Space का use करना
  • Meaningless नाम रखना
  • Case-sensitivity को ignore करना

अगर आप C language for beginners Hindi learner हैं, तो इन mistakes से बचना बहुत ज़रूरी है।

Differences Between Keywords and Identifiers in C

Feature Keywords in C Identifiers in C
Definition Reserved words with predefined meaning in the C language. User-defined names used to identify variables, functions, arrays, etc.
Usage Used to define data types, control structures, and program logic. Used to name program elements such as variables and functions.
Example int, float, if, return totalMarks, sum, studentName
Modification Cannot be modified or redefined by the programmer. Can be created, modified, or renamed by the programmer.
Position in Code Appear at fixed positions according to C syntax rules. Can appear anywhere in the program where naming is required.
Case Sensitivity Case-sensitive and must be written in lowercase. Case-sensitive; uppercase and lowercase letters are treated differently.

Types of Identifiers in C

C Programming में Identifiers को उनके उपयोग के आधार पर अलग-अलग प्रकारों में समझा जा सकता है। यह classification beginners के लिए बहुत helpful होती है।

1️⃣ Variable Identifiers

Variables को दिए गए नाम variable identifiers कहलाते हैं।

int totalMarks;
float average;

2️⃣ Function Identifiers

Functions के नाम function identifiers होते हैं।

int calculateSum() {
    return 0;
}

3️⃣ Array Identifiers

Array का नाम भी एक identifier होता है।

int marks[5];

4️⃣ User-Defined Identifiers

Programmer द्वारा बनाए गए सभी meaningful नाम user-defined identifiers होते हैं।

Identifier और Scope का संबंध

Identifier केवल नाम नहीं होता, बल्कि उसका scope भी होता है। Scope यह तय करता है कि identifier program के किस भाग में accessible होगा।

Example: Same Identifier, Different Scope

int x = 10;   // Global identifier

void display() {
    int x = 20;   // Local identifier
    printf("%d", x);
}

ऊपर दिए गए code में:

  • दोनों identifiers का नाम x है
  • लेकिन scope अलग होने के कारण value अलग है

यह concept viva और interviews में अक्सर पूछा जाता है।

Identifiers से जुड़े Common Compiler Errors

Beginners को identifiers लिखते समय अक्सर compiler errors मिलते हैं। कुछ common errors नीचे दिए गए हैं:

❌ Error 1: Identifier starts with number

int 2marks;

Error: expected identifier

❌ Error 2: Using keyword as identifier

int float;

Error: expected identifier before ‘float’

❌ Error 3: Using special character

int total-marks;

इन errors को समझने से debugging आसान हो जाती है।

Quick Revision – Identifiers in C

  • Identifier किसी variable, function या array का नाम होता है
  • Identifier letter या underscore से शुरू होना चाहिए
  • Keywords को identifier नहीं बना सकते
  • Identifier case-sensitive होता है
  • Meaningful identifiers program readability बढ़ाते हैं

यह section exams से पहले revision के लिए बहुत उपयोगी है।

👉 अब आपकी बारी

👉 अगर आपको C Programming की Basics सच में समझनी हैं, तो:

  • ✅ इस पोस्ट को Bookmark करें
  • ✅ अपने Classmates / Friends के साथ Share करें
  • ✅ नीचे Comment करें – “आप C Language कहाँ से सीख रहे हैं?”

💡 याद रखिए – Strong Programming की शुरुआत Strong Basics से होती है!

FAQs – Identifiers in C

📌 Further reading

🧑‍💻 About the Author

Anurag Rai एक टेक ब्लॉगर और नेटवर्किंग विशेषज्ञ हैं जो Accounting, AI, Game, इंटरनेट सुरक्षा और डिजिटल तकनीक पर गहराई से लिखते हैं।

Post a Comment

Blogger

Your Comment Will be Show after Approval , Thanks

Ads

 
↑ Top