Types of C Constants
C constants can be divided into two major categories:
(a) Primary Constants
(b) Secondary
Constants
At this stage we would restrict our discussion to only
Primary Constants.
Namely, Integer, Real and Character constants. Let us see
the details of each of these constants.
For constructing these different types
of constants certain rules have been laid down.
These rules are as under:
Rules for Constructing
Integer Constants
(a) An integer constant must have at least one digit.
(b) It must not have a decimal point.
(c) It can be either
positive or negative.
(d) If no sign precedes an integer constant it is assumed to
be positive.
(e) No commas or blanks are allowed within an integer constant.
(f) The
allowable range for integer constants is -32768 to 32767.
Truly speaking the
range of an Integer constant depends upon the compiler.
For a 16-bit compiler
like Turbo C or Turbo C++ the range is –32768 to 32767.
For a 32-bit compiler the range would be even greater.
Question like what exactly do you mean by a 16bit or a 32-bit compiler,
Till that time it would be assumed that we are working with a 16-bit compiler.
Ex.: 426 +782 -8000 -7605

Comments
Post a Comment