Constants in C Programming

Constants in C :
A constant is an entity that doesn’t change during the execution of a program.

Followings are the different types of constants :
1. REAL CONSTANT :
• It must have at least one digit.
• It must have a decimal point which may be positive or negative.
• Use of blank space and comma is not allowed between real constants.
• Example:
+194.143, -416.41

2. INTEGER CONSTANT :
• It must have at least one digit.
• It should not contain a decimal place.
• It can be positive or negative.
• Use of blank space and comma is not allowed between integer constants.
• Example:
1990, 194, -394

3. CHARACTER CONSTANT :
• It is a single alphabet or a digit or a special symbol enclosed in a single quote.
• Maximum length of a character constant is 1.
• Example:
‘T’, ‘9’, ‘$’

4. STRING CONSTANT :
• It is collection of characters enclosed in double quotes.
• It may contain letters, digits, special characters and blank space.
• Example:
“Technowell Web Solutions, Sangli”

Leave A Comment

Your email address will not be published. Required fields are marked *