Constant and keyword in c++
Constant
It's may be ,int,float,double and character data type.
Rule of constructing integer constant
- It's must have atleast one digit.
- It's must not have a decimal point.
- It's must be positive or negative.
- The range of integer constant is between -32768 to +32767.
- No comma and blank space are allowed in integer constant.
Rule of constructing floating constant
- It's must have atleast one digit.
- It's must have a decimal point.
- It's must be positive or negative.
- No comma and blank space are allowed in floating constant.
Rule of constructing character constant
- It is a single alphabet,digit and special simbol.
- The length of character constant is 1 character.
- character constant is enclosed within single qoutes (ex- char c='A';).
Use of constant in program
There are two ways of using constant in c++ programming.
- Using constant
- Using #define
Example
int rollono=50;float marks=80.5;
char grade='A';
Here,50 is integer constant,. 80.5 is float constant and 'A' is character constant.
Keyword.
The word has a predefine meaning is called keyword. It's functionality is also predefine. It can not be used as an identifiers.
Since they are used by the language, these keywords are not available for re-definition or overloading.
In adition to keyword ,there are identifiers with special meaning, which may be used as names of objects or functions, but have special meaning in certain contexts.
There are 32 keyword in c++
![]() |
Keyword in c++ The name posix is reserved for a future top-level namespace. The behavior is undefined if a program declares or defines anything in that namespace. . |
Comments
Post a Comment
If you have any doubt. Please comment me know.