Constants in C Language | C Language Tutorial - Computer Times

Latest

Wednesday, 15 August 2018

Constants in C Language | C Language Tutorial


Constants in C Language

Constants are expressions with a fixed value. This is referred to as a fixed value that does not change during the execution of the program.


1     Integer Numerals: They are numerical constants that identify integer values
       Int x=5;
       Floating Point Numbers: They express numbers with decimals and/or exponents.
       floate y=20.5 ;
    Character and string literals-:  There also exist non-numerical constants, like:
'z'
'p'
"Hello world"
"How do you do?"
The first two expressions represent a single character constants and the following two represent string literals composed of several characters. Notice that to represent a single character we enclose it between single quotes (') and to express a string (which generally consists of more than one character) we enclose it between double quotes (").

Declared constants in C Language (const) :-

With the const prefix, you can declare constants with a specific type in the same way as you would do with a variable:
const int pathwidth = 100;
const char ch = 'a';

Here, pathwidth and tabulator are two typed constants. They are treated just like regular variables except that their values cannot be modified after their definition.

Computer Coaching in Jalandhar with Dinesh Sir,C,C++,Java Language, Computer Science CBSE,ICSC,State Board.


CLanguageCoachinginjalandhar

#C++LanguageCoachinginjalandhar

#JavaLanguageCoachinginjalandhar

#ComputerScienceCoachinginjalandhar

Best Digital Marketing Jalandhar

Website Design Jalandhar

SEO SERVICES IN JALANDHAR

SMO Services Jalandhar

Maths Coaching Jalandhar

Digital Jalandhar, Online Coaching,Website Development,SEO and SMO Services

No comments:

Post a Comment