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.
- https://www.facebook.com/ComputerTimesWithDinesh/
- https://twitter.com/ComputerTimes2/
- https://www.instagram.com/computertimeshwithdinesh/
- https://www.youtube.com/user/dineshlohiya123/featured?view_as=subscriber/
- #CLanguageCoachinginjalandhar
- #C++LanguageCoachinginjalandhar
- #JavaLanguageCoachinginjalandhar
- #ComputerScienceCoachinginjalandhar
No comments:
Post a Comment