TODAY JAVA SCHOOL

In java school, programming, design, computer general knowledge, web application, software, web services, social media, digital marketing, oops, concept of programming language, oops feature, console media, graphics medium, first programming, c, c ++ , Java, PHP, SQL, MySQL, HTML, HTML_5, J_query, JavaScript, Bootstrap, Framework, images with logos, examples, shared and explained.

https://www.amazon.in/b?node=26373545031&linkCode=ll2&tag=1234567801cdb-21&linkId=3b9882431b00409b44141e0344b35a15&language=en_IN&ref_=as_li_ss_tl

Breaking

Monday, 4 May 2020

Constants In C Language | Constants In C Language In Hindi

Constants In C Language


If you want to define a variable whose value cannot change, you can use the const keyword. This will create a constant.

download image of constant in c

Fig: Constant In c 

For Example

Const double PI=3.14;

We have added keyword const.

And here, PI is a symbolic constant; its values cannot be changed.

Const double PI=3.14;

PI=2.9; //Error

Program of Constant

#include<stdio.h>
int main()
{
Const float  PI=3.14;
PI=3.4;
Printf(“the value of PI is %f”,PI);
return 0;
}

Output:

Compile time error: cannot modify const object.

No comments:

Post a Comment