Words that have special meaning in a programming language and make readable to a program are called keywords. Various websites, books, and articles have wrong concepts about keywords and reserve words that “ All keywords are reserved words in our programming language that have a specific meaning”. This concept is wrong because, in a programming language, reserve words are words that are reserved to use in the future in a language. Not all but most of the keywords are reserve words and vice versa.
As above procedure shows that all the predefined functions and keywords are declared in the compiler.
Keywords are pre-defined words in a compiler in the programming language that stored some specific meaning in them. For example, some keywords use for data type, some keywords use for data structure, some keywords use for conditional structure, and some for repetitive structures. Keywords and reserve words can only use for a specific purpose. Programmers cannot use specific keyword names such as int, string, or float names used to create and define their variable data type. In practical usage, reserve words are keywords. Keywords are pre-defined and cannot be used as an identifier. User-defined functions are not keywords.
- According to literature, C language contains 32 keywords that are also keywords of C++ language.
- Fortran has no reserved words, all keywords such as if then, else, etc., are used as identifiers
Reserve words are the keywords that are reserve to use and cannot be used as the name of identifiers. There are no distinct definition reserve words except this. Many of the Reserve words that are reserve to use in the future are future keywords.
size of is the only word that is both keyword and operator.
char float = ’2.3’;
This is a compiler error because you use the float keyword as a user-defined variable.
Identifiers are user-defined functions and variable names. It is provided the name of method or variable by a user.
The difference between reserve and keywords
Keywords and reserve words cannot be defined by the user, their functionalities are defined in the compiler. They must be letters. We cannot use them for naming variables, methods, or classes. In practice, reserve words are reserve for future modification of language and keywords are the modified form of reserve words.
C++ language Keywords and reserve words List
|If and else||Auto||register|
|goto||Return||break and continue|
|switch and case||typedef||Struct|
|float and double||do-while loop||auto|
Words that have special meaning in a language are called Keywords. Keywords are the pre-defined words that have special functionalities to the compiler. Reserve words cannot be used as the name of a user-defined class, method, or variable. They have some specific meaning.