C Constants

C Constants is the most fundamental and essential part of the C programming language. Constants are the fixed values that are used in a program, and its value remains the same during the entire execution of the program.

Rules of constants

  • Constants are also called literals.
  • Constants can be any of the data types.
  • It is considered a best practice to define constants using only upper-case names.


Declaration of Constant

Example of Constant


Constants can be of following types.

  • integer constant.
  • floating constant.
  • character constant.
  • string literal.

The following table shows the constants and its data types with Example

constant type data type(Example)
integer constant int (53, 762, -478 etc ) unsigned int (5000u, 1000U etc) long int, long long int (483,647 2,147,483,680)
floating constant float (10.456789) doule (600.123456789)
character constant char (Example: ‘A’, ‘B’, ‘C’)
string literal char (Example: “ABCD”, “Hai”)