What are keywords and identifiers ? give example.
Every language has keywords and identifiers, which are only understood by its compiler. Keywords are predefined reserved words, which possess special meaning. Each keyword defines the “type” declared data. Keywords should not be used as identifiers. An identifier is a unique name given to a particular variable, function or label of class in the program. To create a variable both a keyword and an identifier are bind together. This content further elaborates the difference between keyword and an identifier.
The words which are reserved by C++ are called “keywords”.These keywords can not be used to name an identifier. A keyword cannot be used to name other entity of the program. Each keyword has a distinct meaning and is used by a compiler to perform a specific action. For example, ‘int’ is used to create an identifier of integer type, ‘float’ is used to create an identifier of float type. A keyword can not be used to name an identifier. A keyword cannot be used to name other entity of the program.
The name you provide to an entity in a program so that it can be uniquely identified is called “identifier”. The names of variables, functions, labels of a class and various other user-defined objects are ‘identifiers’. The identifier can never be used as a ‘keyword’.