What is integer constant in C?

Integer constant in C is a data type that is represented by const int. const int is capable of storing an integer in decimal, octal, and hexadecimal bases. The value to const int is assigned only when it is declared and cannot be changed afterward.

Declaration

The declaration of const int is shown below:

Examples

Consider the table below, which shows examples of the declaration of const int in decimal, hexadecimal, and octal bases.

Data type

Value range (in decimal)

Decimal

Hexadecimal

Octal

int

-2147483648 to 2147483647

const int num = -5;

const int num = 0x12345678;

const int num = 023;

unsigned

0 to 4294967295

const unsigned int num = 5;

const unsigned int num = 0x1AB5;

const unsigned int num = 023146;

long

-9223372036854775807 to 9223372036854775807

const long int num = 700000000;

const long int num = 0x1AB5114455667788;

const long int num = 012345671234567;

unsigned long

0 to 1844674407370955169

const unsigned long int num = 500000000;

const unsigned long int num = 0x1AB51144D56E7F8;

const unsigned long int num = 012345671234567;

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved