C++ keywords
A keyword is a word in C++ language that has a predefined meaning and purpose. The meaning and purpose of C++ Keywords are defined by the developer of language. It cannot be changed or redefined by the user. C++ Keywords can be used for the same purpose for which it is defined. C++ Keywords also known as reserved words. There are different types of keywords in C++ language. The total number of keywords is 63.
asm | auto | bool | break |
case | catch | char | class |
const | const_cast | continue | default |
delete | do | double | dynamic_cast |
else | enum | explicit | export |
extern | false | float | for |
friend | goto | if | inline |
int | long | mutable | namespace |
new | operator | private | protected |
public | register | reinterpret_cast | return |
short | signed | size-of | static |
static_cast | struct | switch | template |
this | throw | true | try |
typedef | type-id | type-name | union |
unsigned | using | virtual | void |
volatile | wchar_t | while |
C++ identifier
The identifier is the names used to represent variables, constants, types, functions and labels in the program. The identifier is an important feature of all computer languages. A good identifier name should be descriptive but short.
An identifier in C++ may consist of 31 characters. If the name of an identifier is longer than 31 characters, the first 31 characters will be used. The remaining characters will be ignored by the C++ compiler. Some important roles for the identifier name are as followings.
- The first character must be alphabetic or underscore (_).
- The identifier name must consist of only alphabetic characters, digits or underscores.
- The reserved word cannot be used as an identifier name.
Types of Identifiers in C++
C++ provides the following types of identifiers
Standard Identifiers/User Define
A type of identifier that has special meaning in C++ is known as a standard identifier.
C++ cannot use a standard identifier for the original purpose if it is redefined.
Example
c-out and c-in, are examples of standard identifiers. These are the name of the input/output objects defined in standard input/output library iostream.h.
User-defined Identifiers
The type of identifier that is defined by the programmer to access memory location is known as a user-defined identifier. The user-defined identifier is used to store data and program results.
Example
Some examples of user-defined identifiers are b, subjects, and age, etc.