Академический Документы
Профессиональный Документы
Культура Документы
A Constant is a value which does not change during the course of execution of a
program.
Numeric Constants-
Numeric constants contain only numeric data. There are basically 2 types of
numeric constants:
(i) Integer Constant
(ii) Real Constant
(i) Integer Constant - Integer constants are those constants which neither
have a decimal point nor an exponent. They may be preceded by plus or
minus sign. Ex: 100000 but 1, 00,000 is invalid.
Types of Integer Constant-
(a) Decimal Integer Constant
(b) Octal Integer Constant
(c) Hexadecimal Integer Constant
Non-Numeric Constants-
Non-numeric constants contain both numeric as well as non-numeric data, but
arithmetic operations cannot be applied on numeric constants in this case. Basically there
are 2 types of non-numeric constants:
(i) Single Character Constant
(ii) String Constant
(i) Single Character Constants - These are single characters enclosed within
single quotes. Ex: ‘A’, ‘b’, ‘ ’, ‘8’ etc.
(ii) String Constants - These are the collection of characters enclosed within
double quotes. Ex: “STRING”, “Delhi”, “1982” etc.