C Language Syntax aur Tokens – Hinglish Me Simple Guide (2025)

Namaskar dosto!

Agar tum C programming seekhna chahte ho, toh sabse pehle tumhe C Language Syntax aur Tokens ka basic samajhna zaroori hai.

Is article me tumhe simple Hinglish me milega:

  • C language ka syntax kya hota hai
  • Tokens kya hote hain
  • Keywords ka kya role hota hai

Yeh guide specially beginners ke liye hai jo coding me naye naye kadam rakh rahe hain. Toh chalo bina time waste kiye shuru karte hain!


C Language Syntax Kya Hota Hai?

Simple Definition:
C language syntax ka matlab hai woh rules aur structure jo define karte hain ki C me code kaise likha jaaye.

Syntax kya hota hai?
Syntax basically programming language ke rules hote hain, jinke hisaab se tumhe code likhna hota hai. Agar syntax galat hua toh compiler error dega.

Example of Basic C Program:

#include <stdio.h>

int main() {
    printf("Hello, World!");
    return 0;
}

Isme kya hai:

  • #include <stdio.h>: Input-output functions use karne ke liye
  • int main() {}: Program ka starting point
  • {}: Block define karne ke liye
  • ;: Har statement ke baad lagta hai

Compiler Role:
Compiler code ko syntax ke according check karta hai. Agar sahi hai toh run hota hai, nahi toh error milta hai.


Tokens in C Language Kya Hote Hain?

Simple Definition:
Token programming language ka sabse chhota meaningful unit hota hai. Compiler code ko tokens me todta hai for validation.

Examples:

  • Keyword: int
  • Identifier: main
  • Operator: =
  • Constant: 5
  • Punctuator: ;

C Language Me Tokens ke 6 Types

Token TypeDescriptionExample
1. KeywordsReserved words with special meaningint, return, if, else
2. IdentifiersNames for variables, functions etc.main, sum, age
3. ConstantsFixed values in program10, -5, ‘a’, 3.14
4. StringsSequence of characters in double quotes“Hello, World!”
5. OperatorsSymbols to perform operations+, -, ==, &&
6. SymbolsPunctuators for code structure{}, (), ;, []

Tokens aur Syntax ka Relation

Syntax tokens ke correct order ko define karta hai.

Example:

int a = 5;

Tokens:

  • int (keyword)
  • a (identifier)
  • = (operator)
  • 5 (constant)
  • ; (punctuator)

Yeh sahi order hai isliye code error-free chalega.


Example Code with Token Breakdown:

#include <stdio.h>

int main() {
   int a = 5;
   printf("Value of a is %d", a);
   return 0;
}

Breakdown:

  • #include → preprocessor
  • <stdio.h> → header
  • int → keyword
  • main → identifier
  • {} → block symbols
  • a → variable
  • = → operator
  • 5 → constant
  • ; → end of statement
  • printf → function
  • "Value of a..." → string
  • return → keyword
  • 0 → constant

FAQs (Frequently Asked Questions)

Q1. C me tokens kya hote hain aur compiler kaise unhe handle karta hai?
Answer:
Tokens C language ke sabse chhote meaningful units hote hain — jaise keywords (int), identifiers (main), operators (=), constants (5) aur punctuators (;). Compiler sabse pehle lexical analysis ke dauraan code ko tokens me todta hai, phir unka syntax aur structure validate karta hai. Galat tokens hone par compiler error deta hai.


Q2. C me total kitne types ke tokens hote hain?
Answer:
C programming language me 6 types ke tokens hote hain:

  1. Keywords – jaise int, return
  2. Identifiers – jaise main, sum
  3. Constants – jaise 10, 'a'
  4. Strings – jaise "Hello"
  5. Operators – jaise +, ==
  6. Special Symbols (Punctuators) – jaise {}, ;, []

Q3. Keywords aur identifiers me kya difference hota hai?
Answer:

  • Keywords C ke predefined words hote hain jinka specific meaning hota hai (e.g., for, if, return). Inhe variables ya functions ke naam ke roop me use nahi kiya ja sakta.
  • Identifiers user-defined names hote hain jo variables, functions, arrays ke liye use kiye jaate hain (e.g., marks, main, totalSum).

Q4. Constants aur string literals me kya antar hai?
Answer:

  • Constants fixed values hoti hain jo program me change nahi hoti (e.g., 10, 'a', 3.14).
  • String literals double quotes me likhi character sequence hoti hai (e.g., "Hello, World!"). Dono tokens hote hain, lekin string literals ek alag category me aate hain.

Q5. Tokens C ki compilation process me kis tarah kaam karte hain?
Answer:
Compilation process ke first step “lexical analysis” me compiler code ko tokens me divide karta hai. Har token ka role syntax ke hisaab se validate kiya jaata hai. Agar token sequence galat ho, toh syntax error aata hai. Sahi token stream se syntax tree banta hai jo code ko machine language me convert karne me help karta hai.


Conclusion

  • Syntax: Programming ke rules hote hain jinke bina code nahi chalega
  • Tokens: C language ke smallest meaningful parts
  • 6 Types: Keywords, Identifiers, Constants, Strings, Operators, Symbols
  • Syntax aur tokens milke code ko readable aur compiler-friendly banate hain
  • Har beginner ko yeh samajhna zaroori hai

Next Article Padhein:

C Language Kya Hai? Beginner-Friendly Guide in Hinglish (2025)

Agar aapko yeh article helpful laga ho to ise share karein, comment karein, aur apne doston ko bhi recommend karein.
Next article kis topic par chahiye? Comment karke zarur batao.

Written by: Aditya (Programming Sikho)

Spread the love

Leave a Comment