Rules for constructing C constant
1. Integer Constants
in C:
- An
integer constant must have at least one digit.
- It
must not have a decimal point.
- It
can either be positive or negative.
- No
commas or blanks are allowed within an integer constant.
- If
no sign precedes an integer constant, it is assumed to be positive.
- The
allowable range for integer constants is -32768 to 32767.
2. Real constants in
C:
- A
real constant must have at least one digit
- It
must have a decimal point
- It
could be either positive or negative
- If
no sign precedes an integer constant, it is assumed to be positive.
- No
commas or blanks are allowed within a real constant.
3. Character and
string constants in C:
- A
character constant is a single alphabet, a single digit or a single
special symbol enclosed within single quotes.
- The
maximum length of a character constant is 1 character.
- String
constants are enclosed within double quotes.
Comments
Post a Comment