Free tutorials in Hindi & English Daily computer, mobile and IT guides Beginner friendly learning
Blog · C Programming · 03 Jul 2026 · Hindi + English

Types of Constants in C: Integer, Float, Character, String and Enum

C has 5 main types of constants: integer, floating-point, character, string and enumeration constants. See rules and examples for each type.

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

How many types of constants are there in C?

C has 5 main types of constants: integer, floating-point, character, string and enumeration constants.

What is the difference between 'A' and "A" in C?

'A' in single quotes is a character constant (1 byte value), while "A" in double quotes is a string constant of 2 bytes: the letter A plus a hidden null terminator.

Is 025 equal to 25 in C?

No. A leading zero makes it an octal constant, so 025 equals 21 in decimal, not 25.