A constant is an entity whose value does not change throughout the program execution.
There are two types of constants
1)Numerical constants
2)Character constants
Numerical constants
The constants which are in number format is said to be numerical constants
These are of two types
a)Integer constants
b)Floating point constants
Integer constants
These are normal numbers whose range depends on data type
Ex:-
int a=3453;
long l=2300000;
Floating point constants
These are decimal point numbers. The range of these variables depends on data type.
Ex:-
float f=34.78;
double d=2367.7654;
Character Constants
Character set
The character set in C Language can be grouped into the following categories.
2. Digits
3. Special Characters
4. White Spaces
White Spaces are ignored by the compiler until they are a part of string constant. White Space may be used to separate words, but are strictly prohibited while using between characters of keywords or identifiers.
C Character-Set Table
Letters | Digits |
Upper Case A to Z | 0 to 9 |
Lower Case a to z | . |
Special Characters
, | .Comma | & | .Ampersand |
. | .Period | ^ | .Caret |
; | .Semicolon | * | .Asterisk |
: | .Colon | - | .Minus Sign |
? | .Question Mark | + | .Plus Sign |
' | .Aphostrophe | < | .Opening Angle (Less than sign) |
" | .Quotation Marks | > | .Closing Angle (Greater than sign) |
! | .Exclaimation Mark | ( | .Left Parenthesis |
| | .Vertical Bar | ) | .Right Parenthesis |
/ | .Slash | [ | .Left Bracket |
| .Backslash | ] | .Right Bracket |
~ | .Tilde | { | .Left Brace |
- | .Underscore | } | .Right Bracket |
$ | .Dollar Sign | # | .Number Sign |
% | .Percentage Sign | . | . |
The keywords are reserved words which are already registered in C library. These words cannot be used as identifiers in the program. There are basically 32 keywords in C language. They are
auto | .else | .register | .union |
.break | .enum | .return | .unsigned |
.case | .extern | .short | .void |
.char | .float | .signed | .volatile |
.const | .for | .size of | .while |
.continue | .goto | .static | . |
.default | .if | .struct | . |
.do | .int | .switch | . |
.double | .long | .typedef | . |
No comments:
Post a Comment