Keywords vs Identifiers

 

💻 Keywords & Identifiers in C (Deep but Easy Explanation)

Chalo isko concept + logic + examples ke saath properly samajhte hain 👇


🔹 1. Keywords in C 🔑

Keywords wo words hote hain jo C language me pehle se defined (reserved) hote hain.
Inka meaning fixed hota hai — aap ise change nahi kar sakte.

👉 C language (developed by Dennis Ritchie) me ye words compiler ko instructions dete hain.


✅ Example se samjho

int a = 10;

👉 Yahan:

  • int → compiler ko batata hai ki variable integer type ka hai
  • return → function ka result batata hai
  • if, else → decision making ke liye

👉 Matlab:
Keywords = Language ke built-in commands 💡


🔹 Total Keywords (32)

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

🔹 Keywords ka kaam (Real Understanding)

KeywordKaam
int, float, charData type batate hain
if, else, switchDecision lene ke liye
for, while, doLoop chalane ke liye
returnFunction end karne ke liye
struct, unionData structure banane ke liye

❌ Important Rule

👉 Keyword ko kabhi bhi name ke tarah use nahi kar sakte

int int = 5; // ❌ Error

🔹 2. Identifiers in C 🏷️

Identifiers wo naam hote hain jo programmer khud deta hai
👉 Variables, functions, arrays, etc. ke liye


✅ Example

int marks = 90;

👉 Yahan:

  • int → keyword 🔑
  • marks → identifier 🏷️
  • 90 → constant

👉 Matlab:
Identifiers = Aapke diye hue names 💡


🔹 Real-Life Example 🤔

Socho:

👨‍🏫 Teacher = Keywords
👨‍🎓 Students ke naam = Identifiers

👉 Teacher fixed hai
👉 Students ke naam aap rakhte ho


🔹 Rules for Identifiers

✔ Start with letter ya _
✔ Numbers use kar sakte ho (start me nahi)
✔ No space
✔ No special symbols
✔ Keyword nahi hona chahiye


❌ Wrong Identifiers

1marks // number se start ❌
total marks // space ❌
int // keyword ❌
@name // symbol ❌

🔹 Keywords vs Identifiers (Clear Difference)

FeatureKeywords 🔑Identifiers 🏷️
MeaningPredefinedUser-defined
ControlLanguage ke paasProgrammer ke paas
CountFixed (32)Unlimited
Exampleint, ifmarks, sum

🔹 One Strong Example 🧠

int total_marks = 100;

👉 Breakdown:

  • int → keyword
  • total_marks → identifier
  • 100 → constant

🔹 Final Concept (Very Important)

👉 Keyword = kya karna hai (instruction)
👉 Identifier = kis pe karna hai (name)


🔥 Short Trick to Remember

  • Keywords = System ke words
  • Identifiers = Aapke words

Comments

Popular posts from this blog

Introduction to Computer

History of Computer

Computer Generation