InterviewSolution
Saved Bookmarks
| 1. |
Constants C |
|
Answer» Constants C List of Constants in C![]() Different ways to define Constants in CThere are mainly 2 ways to define constant in C programming. (1)CONST keyword (2)#define preprocessor (1)const keywordThe const keyword is used to define constant in C programming. const float PI=3.14; Now below example is the use of const variable PI ![]() Output:- The value of PI is: 3.140000 Another example which use to change contsant value ![]() Output:- COMPILE Time Error: Cannot modify a const object (2)#define preprocessorThe #define preprocessor is also used to define constant. Syntax:- #define token value ![]() Output:- 3.140000 |
|