Constants in C Programming Language: Primary & Secondary
Posted on January 25, 2010
Constants in C Programming Language
The keyword const can be added to the declaration of an object to make that object a constant rather than a variable.
The general syntax of constant declaration is :
Const data-type name = value;
Here const is known as a keyword that must be used to declare a constant. Name is the name of the constant, data-type is the type of the data which we are declaring and value is the constant value of the data-type.
For example :
Const int manager_id=001;
Here we declared a constant named as manager_id of type integer which is assigned a value 001.
Types Of Constants:
C constants can be divided into two categories :
- Primary constants
- Secondary constants
Primary constants are further divided into :
- Integer constants
- Real constants
- Character constants
Secondary constants are further divided into :
- Array
- Pointers
- Union
- Structures
- Enum etc
Looking for a Fresher Job? Post Your Resume Free !!!
More Articles From "C Programming" Category
- Variable Types in C Programming Language
- Derived Data Types in C Programming Language
- C Language Operator Types: Operators in C
- C Programming Primary Constants: Integer, Real & Character
- Storage Classes in C Programming Language: Auto, Register, Extern & Static Storage Types
- C Data Types: Range & Size
- Type Modifiers in C Language: signed, unsigned, long & short
- C Language Fundamental Data Types: Int, Float, Char, Double
- C Language Data Types
- C Language Keywords