C Constants

C Constants refer to fixed values whose values remain the same during the whole program. Constants can be of any of the basic data types like an integer constant, a floating constant, a character constant, or a string literal.

Difference between constants and variables

Constants are also like normal variables. But, the only difference is, Constants values can’t be modified by the program once they are defined. While we can change the value of variables.

Types of C Constants:

Here is the list of all types of Constants supported in C language.

Constant Type of Value Stored
Integer Constant It stores integer value
Floating Constant It stores float value
Character Constant It stores character value
String Constant It stores string value

Declaration of Constant in C:

Here is the list which will help you to understand how to declare constants:

Declaration Explanation
const int a = 10; read as “a is an integer which is constant”
int const a = 10; read as “a is a constant integer”

Example of C Constant:

Let’s see an Example of C program:

Congratulations! Chapter Finished. Do you want to practice more?
Exercises & Assignments
  • No Content Found.
  • Interview FAQs
  • No Content Found.