C Variables in Hindi – पूरी जानकारी (Types, Examples, Uses)

2

Programming में data को store करने के लिए variables का उपयोग किया जाता है। C Language एक powerful, fast और low-level control देने वाली भाषा है, जिसमें variables program के अंदर data को temporarily store करके उसे process करने में मदद करते हैं।

इस article में हम C variables को सबसे आसान भाषा में समझेंगे—उनके rules, types, syntax, memory usage, examples और FAQs के साथ।


🟠 Variable क्या होता है?

Variable एक नाम (name) है जिसके अंदर हम value को store करते हैं।

Easy language में:

👉 Variable = Data रखने का container
👉 Variable की value बदल सकती है (that’s why it is called variable)

Example:

int age = 20;

यहाँ:

  • int = data type
  • age = variable name
  • 20 = value

🔵 Variable Memory में कैसे store होता है?

C language में हर variable RAM (Random Access Memory) में एक fixed space occupy करता है।

Example:

  • int → 4 bytes
  • float → 4 bytes
  • char → 1 byte

Variable की value memory में रखी जाती है और इसका नाम उस location का reference होता है।


🟢 Variable Declare कैसे करते हैं?

C में variable declare करने का basic syntax:

data_type variable_name;

Example:

int marks;
float percentage;
char grade;

🟣 Declare + Assign एक साथ

int marks = 95;
float pi = 3.14;
char letter = 'A';

🔵 Variable Naming Rules (Important for Exams)

C variables create करते समय कुछ rules follow करने जरूरी हैं:

✔ Valid names:

  • letters (a–z, A–Z)
  • digits (0–9)
  • underscore (_)

❌ Invalid:

  • कोई space नहीं होना चाहिए
  • Variable number से start नहीं हो सकता
  • Special symbols जैसे @, #, %, & नहीं allowed

Examples:

VariableValid?
age✔ Yes
_roll✔ Yes
9name❌ No
full name❌ No
price$❌ No

🟠 Variable के Types (C में 3 categories)

C language में variables तीन प्रकार से classify होते हैं:


1️⃣ Local Variables

  • किसी function या block के अंदर declare होते हैं
  • केवल उसी block के अंदर access किए जा सकते हैं

Example:

void test() {
    int x = 10;  // local variable
}

2️⃣ Global Variables

  • किसी भी function के बाहर declare होते हैं
  • पूरी program में use किए जा सकते हैं

Example:

int total = 100; // global variable

void main() {
    printf("%d", total);
}

3️⃣ Static Variables

  • Memory program खत्म होने तक exist करती है
  • Value retain रहती है (reset नहीं होती)

Example:

void counter() {
    static int x = 1;
    x++;
    printf("%d", x);
}

🔵 C Variable Storage Classes (Important Topic)

Storage ClassScopeLifetimeKeyword
autofunction/blockblock end तकauto
staticfunction/blockentire programstatic
externglobalentire programextern
registerfunction/blockfast accessregister

🟣 Examples of Variable Use

1. Sum of Two Numbers

int a = 10;
int b = 20;
int sum = a + b;
printf("%d", sum);

2. Area of Circle

float radius = 5.5;
float area = 3.14 * radius * radius;
printf("%.2f", area);

👉 Related: C Operators in Hindi

Loops, conditions और expressions में variables को evaluate करने के लिए operators का उपयोग होता है।

👉 Related: C Data Types in Hindi

Variables किस type की value store करेंगे, यह data types से तय होता है।

👉 Related: C Loops in Hindi

Variables का scope और lifetime functions पर depend करता है।


🟢 Beginners के Common Mistakes

  • Variable declare किए बिना use करना
  • Wrong data type use करना
  • Variable name गलत लिख देना
  • char variable में double quotes लगाना (गलत)

Example:

char ch = 'A';   // Correct
char ch = "A";   // Wrong

❓ FAQs (Boosts SEO)

Q1. C में variable किसे कहते हैं?

Variable एक container होता है जो data store करता है।

Q2. C में कितने types के variables होते हैं?

Local, Global और Static.

Q3. C में variable की memory कब free होती है?

Local variable → block समाप्त होते ही
Static → program खत्म होने पर

Q4. क्या variable name spaces contain कर सकता है?

नहीं, spaces allowed नहीं हैं।


⭐ Conclusion

C Variables C programming की foundation हैं। हर program variables के बिना incomplete है क्योंकि ये data को store, modify और manage करने का काम करते हैं। इस article में हमने variables की पूरी theory, rules, types, examples और SEO internal linking को cover किया।

2 thoughts on “C Variables in Hindi – पूरी जानकारी (Types, Examples, Uses)

Comments are closed.