Introduction of C Constants

C constants refers to the data items that do not change their value during the program execution. Several types of C constants that are allowed in C are:
ConstantType of Value Stored
Integer ConstantConstant which stores integer value
Floating ConstantConstant which stores float value
Character ConstantConstant which stores character value
String ConstantConstant which stores string value


How to Declare Constant in C :-

We can declare constant using const variable. Suppose we need to declare constant of type integer then we can have following two ways to declare it –
const int a = 1; 
int const a = 1;
above declaration is bit confusing but no need to worry, We can start reading these variables from right to left. i.e
DeclarationExplanation
const int a = 1;
read as “a is an integer which is constant”
int const a = 1;
read as “a is a constant integer”
Introduction of C Constants  Introduction of C Constants Reviewed by ANAND PANDEY on 7:53:00 AM Rating: 5

No comments:

Created By Anand Pandey. Powered by Blogger.