Published on: 12th Nov 2010    |   Last Updated on: 24th Nov 2011

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 :

  1. It must have at least one digit.
  2. It must have a decimal point which may be positive or negative.
  3. Use of blank space and comma is not allowed between real constants.
  4. Example:

  5. +194.143, -416.41

2. Integer Constant :

  1. It must have at least one digit.
  2. It should not contain a decimal place.
  3. It can be positive or negative.
  4. Use of blank space and comma is not allowed between real constants.
  5. Example:

  6. 1990, 194, -394

3. Character Constant :

  1. It is a single alphabet or a digit or a special symbol enclosed in a single quote.
  2. Maximum length of a character constant is 1.
  3. Example:

  4. 'T', '9', '$'

4. String Constant :

  1. It is collection of characters enclosed in double quotes.
  2. It may contain letters, digits, special characters and blank space.
  3. Example:

  4. "Technowell Web Solutions, Sangli"

Link this post on your Blog/Website :

Follow us on :   Technoexam on facebook Technoexam on twitter Technoexam on linkedin Technoexam on youtube