codeGK
Code it ALL
C Constants - CodeGK
♦ C Constants

♣ About C Constants

Constants also hold value of Data Type alike variable but with some additional property.
Constants once defined and initialized can not be changed or manipulated in the remaining part of the code.
Constants come in very handy many times to define some constant valued entity which never changes and can be used multiple times, for example, PI whose approx value is 3.14.

♣ Example1: Constants in C

Constant can be defined for all the data types.
These constant will then behave as read-only mechanism.
In this example, various constants are illustrated.
Example
Input:
Output:

♣ Example2: Violating-Constants in C

In this example, Errors are illustrated when constants are attempted to change/manipulated.
Example
Input:
Output:
Prev_LessonNext_Lesson