Types of Constant in C
It is an identifier whose value can not be changed at the execution time of program. In general constant can be used to represent as fixed values in a C program. Constants are classified into following types.
If any single character (alphabet or numeric or special symbol) is enclosed between single cotes ' ' known as single character constant.
If set of characters are enclosed between double cotes " " known as string character constant.
Declare constant
const keyword are used for declare a constant.
Syntax
const int height = 100;
Example
#include<stdio.h> #include<conio.h> void main() { const int a=10; printf("%d",a); a=20; // gives error you can't modify const getch(); }