C++ Reference Material
Keywords
This page contains a list of all the reserved words in Standard C++, and a few predefined identifiers for the sake of comparison.
Recall the distinction between reserved words and predefined identifiers, which are collectively referred to (by us, at least) as keywords. But be aware that this terminology is not standard. For example, some authors will use keyword in the same sense that we have used reserved word.
auto const double float int short struct unsigned break continue else for long signed switch void case default enum goto register sizeof typedef volatile char do extern if return static union whileThere are another 30 reserved words that were not in C, are therefore new to C++, and here they are:
asm dynamic_cast namespace reinterpret_cast try bool explicit new static_cast typeid catch false operator template typename class friend private this using const_cast inline public throw virtual delete mutable protected true wchar_tThe following 11 C++ reserved words are not essential when the standard ASCII character set is being used, but they have been added to provide more readable alternatives for some of the C++ operators, and also to facilitate programming with character sets that lack characters needed by C++.
and bitand compl not_eq or_eq xor_eq and_eq bitor not or xor
Note that your particular compiler may not be completely up-to-date, which means that some (and possibly many) of the reserved words in the preceding two groups may not yet be implemented.
Beginning C++ programmers are sometimes confused by the difference between the two terms reserved word and predefined identifier, and certainly there is some potential for confusion.
One of the difficulties is that some keywords that one might "expect" to be reserved words just are not. The keyword main is a prime example, and others include things like the endl manipulator and other keywords from the vast collection of C++ libraries.
For example, you could declare a variable called main inside your main function, initialize it, and then print out its value (but you probably shouldn't, except as an experiment to verify that you can!). On the other hand, you could not do this with a variable named else. The difference is that else is a reserved word, while main is "only" a predefined identifier.
Here is a very short list of some of the predefined identifiers you may have encountered:
cin endl INT_MIN iomanip main npos std cout include INT_MAX iostream MAX_RAND NULL string