Constants.
Primary Constants
a. Integer Constants
b. Real Constants
c. Character Constants
Secondary Constants
a. Array
b. Pointer
c. Structures and Unions
d. Enum
Integer Constant:
1. Integer constant must have at least one digit.
2. They must not have a decimal point.
3. They can be positive or negative.
4. If there is no any sign to integer it is assume to be positive.
5. No comma or blank spaces are allowed within the integer constant.
e.g. 426, +756,-588 etc.
Real Constant:
1. These are generally called as floating point constant. They can be
written two forms. That is, fractional form & exponential form.
2. Real constant can be positive or negative.
Chapter 01 Basics of C
Programming in ‘C’ by Mr. Kute T. B. - 8 -
3. They must have decimal point.
4. Default sign is positive.
5. No comma or blank spaces are allowed in the real number.
e.g. 22.45, -85.23, -11.20, +3.211e-4, 5.6e4 etc.
Character Constants:
1. The character constant is a single alphabet or a single digit or a single
special symbol enclosed within the single quotation marks.
2. Maximum length of a character is one character.
e.g. ‘f’, ‘h’, ‘=’, ‘8’ etc.
VariablesIt is an entity that may vary during the program is executing. Variable is the name given to the location of the memory. This location can contain integer, real or character constants.
Rules for creating variable’s name:
1. Variable name is the combination of alphabets, digit & underscore.
2. First character in the variable name must be an alphabet.
3. A keyword can not be a variable.
4. No commas, blanks and special symbols are allowed in the variable
name.
Keywords
Keyword is the word who’s meaning as already being given to the ‘C’ compiler. The keywords can not be given as variable name in ‘C’. These are also called as reserve words. The C supports 32 different keywords listed below:
auto break case char const continue
default do double else enum extern
float for goto if int long
register return short signed sizeof static
struct switch typedef union unsigned void
while volatile near for asm
Operators
Operators are the special symbol use to perform special operation (for example, arithmetic & logical) on operands. Operands are the variables, constants or expressions on which operators perform operation.As per the number of operands required by the operator, it is classified in three categories:
1. Unary operators
2. Binary operators
3. Ternary operators
These operators require one, two and three operands respectively for performing their operation.
No comments:
Post a Comment