Free tutorials & notes in Hindi & English · Clean code examples 🧰 मुफ़्त PDF और फ़ोटो टूल्स →
Blog · C Programming · 03 Jul 2026 · Hindi + English

C में Constants के प्रकार: Integer, Float, Character, String और Enum

C में 5 main प्रकार के constants होते हैं: integer, floating-point, character, string और enumeration constants. हर type के rules और examples देखें.

The 5 types of constants in C

C supports 5 main types of constants: integer, floating-point, character, string and enumeration constants. A constant is any fixed value that appears directly in the code and never changes during execution.

1. Integer constants

int a = 100;      /* decimal                */
int b = 0x1F;     /* hexadecimal (31)       */
int c = 025;      /* octal (21)             */
long d = 500000L; /* long suffix            */
unsigned e = 40U; /* unsigned suffix        */
  • No decimal point, no commas: 1,000 is invalid — write 1000.
  • Prefix 0x means hexadecimal, prefix 0 means octal — a common trap: 025 is 21, not 25.

2. Floating-point constants

float  pi   = 3.14159f;   /* f suffix = float          */
double rate = 8.75;       /* default type is double    */
double big  = 1.5e6;      /* scientific: 1500000.0     */

A number with a decimal point or exponent (e) is a floating constant. Without a suffix it is double; add f for float or L for long double.

3. Character constants

char grade = 'A';      /* single character in single quotes */
char nl    = '\n';     /* escape sequence: newline          */
char tab   = '\t';     /* escape sequence: tab              */
char zero  = '\0';     /* null character                    */
Single quotes only, and exactly one character. "A" (double quotes) is a string constant, not a character constant — a very common exam question.

4. String constants

char name[] = "CodingEasily";   /* double quotes            */
printf("Hello World\n");        /* string literal in printf */

A string constant is a sequence of characters in double quotes. The compiler automatically appends a hidden '\0' (null terminator) at the end, so "Hi" actually takes 3 bytes.

5. Enumeration constants

enum Day { MON, TUE, WED, THU, FRI, SAT, SUN };
/* MON=0, TUE=1, ... SUN=6 automatically */

enum Level { LOW = 1, MID = 5, HIGH = 10 };  /* custom values */

Enum constants are named integer constants. They are true compile-time constants, so they work in case labels and array sizes.

Summary table

TypeExampleKey rule
Integer100, 0x1F, 025No decimal point or commas
Floating-point3.14f, 1.5e6Decimal point or exponent; default double
Character'A', '\n'Single quotes, one character
String"Hello"Double quotes, hidden '\0' at end
Enumerationenum {LOW, HIGH};Named integers, compile-time constant

C में constants के 5 प्रकार

C में 5 main प्रकार के constants होते हैं: integer, floating-point, character, string और enumeration constants. Constant वह fixed value है जो code में directly लिखी जाती है और execution के दौरान कभी नहीं बदलती.

1. Integer constants

int a = 100;      /* decimal                */
int b = 0x1F;     /* hexadecimal (31)       */
int c = 025;      /* octal (21)             */
long d = 500000L; /* long suffix            */
unsigned e = 40U; /* unsigned suffix        */
  • न decimal point, न commas: 1,000 invalid है — 1000 लिखें.
  • Prefix 0x = hexadecimal, prefix 0 = octal — common trap: 025 का मतलब 21 है, 25 नहीं.

2. Floating-point constants

float  pi   = 3.14159f;   /* f suffix = float          */
double rate = 8.75;       /* default type double है     */
double big  = 1.5e6;      /* scientific: 1500000.0     */

Decimal point या exponent (e) वाला number floating constant है. Suffix के बिना यह double होता है; float के लिए f और long double के लिए L लगाएं.

3. Character constants

char grade = 'A';      /* single quotes में single character */
char nl    = '\n';     /* escape sequence: newline          */
char tab   = '\t';     /* escape sequence: tab              */
char zero  = '\0';     /* null character                    */
सिर्फ single quotes, और exactly एक character. "A" (double quotes) string constant है, character constant नहीं — बहुत common exam question.

4. String constants

char name[] = "CodingEasily";   /* double quotes            */
printf("Hello World\n");        /* printf में string literal */

String constant double quotes में characters की sequence है. Compiler अंत में automatically एक hidden '\0' (null terminator) जोड़ देता है, इसलिए "Hi" असल में 3 bytes लेता है.

5. Enumeration constants

enum Day { MON, TUE, WED, THU, FRI, SAT, SUN };
/* MON=0, TUE=1, ... SUN=6 automatically */

enum Level { LOW = 1, MID = 5, HIGH = 10 };  /* custom values */

Enum constants named integer constants हैं. ये true compile-time constants हैं, इसलिए case labels और array sizes में काम करते हैं.

Summary table

TypeExampleKey rule
Integer100, 0x1F, 025न decimal point, न commas
Floating-point3.14f, 1.5e6Decimal point या exponent; default double
Character'A', '\n'Single quotes, एक character
String"Hello"Double quotes, अंत में hidden '\0'
Enumerationenum {LOW, HIGH};Named integers, compile-time constant

Frequently Asked Questions

C में constants कितने प्रकार के होते हैं?

C में 5 main प्रकार के constants होते हैं: integer, floating-point, character, string और enumeration constants.

C में 'A' और "A" में क्या अंतर है?

Single quotes वाला 'A' character constant है (1 byte value), जबकि double quotes वाला "A" 2 bytes का string constant है: letter A और एक hidden null terminator.

क्या C में 025 का मतलब 25 है?

नहीं. आगे लगा zero इसे octal constant बना देता है, इसलिए 025 decimal में 21 के बराबर है, 25 नहीं.

यह lesson कैसा लगा?

आपकी राय से हम content और बेहतर बनाते हैं।

अपना review और सुझाव लिखें (वैकल्पिक)

Review approve होने के बाद आपका नाम और शहर इसके साथ public दिख सकते हैं। Email या phone न लिखें।

▶ CodingEasily on YouTube

Video से सीखें – आसान Hindi में

चुनी हुई video: RDBMS भाग 3 – Class XI Commerce IT

▶ Channel subscribe करें