crackyourinterview.com


To improves our performance please Like Share Subscribe(Will boost us)


Constants C
Question Posted on 25 Aug 2020Home >> Tutorial >> C Language >> Constants C

Constants C
Constants usually refer to fixed values that program may not be change during its execution. And these fixed value also called literals. And constants can be any of the basic data which types is either integer, floating or character constant. And constant value or variable that we cannot changed in the program. And value can be 50,100,"a",3.4 or "crackyourinterview.com" etc. There are different types of constants in C programming.

List of Constants in C


Constant Value List

Different ways to define Constants in C


There are mainly 2 ways to define constant in C programming.
(1)const keyword
(2)#define preprocessor

(1)const keyword


The 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


Constant Set Values
Output:-
The value of PI is: 3.140000


Another example which use to change contsant value


Constant Val Change
Output:-
Compile Time Error: Cannot modify a const object



(2)#define preprocessor


The #define preprocessor is also used to define constant.
Syntax:-
#define token value


Constant Define Value
Output:-
3.140000
0
0




.


Most Visited Questions:-

Deep Learning Questions Answers
Below are the different Deep Leaning Questions and answer a More...

What is Gulpjs and some multiple choice questions on Gulp
Gulpjs is an open source whihc helps in building Javascript More...

Derived relationships in Association Rule Mining are represented in the form of __________.
Derived relationships in Association Rule Mining are repres More...

Continuous Integration Questions Answers
Below are the 20 odd questions for CI or Continuous Integra More...

Microservices Architecture Questions Answers
Below are the different questions on Microservices Architec More...




Other Important Questions

Features of C

Introduction to C

History of C Language

Install C Language

C Variables






@2014-2022 Crackyourinterview (All rights reserved)
Privacy Policy - Disclaimer - Sitemap