+ 1

What are keywords? Can keywords be used as identifiers?

12th Oct 2017, 4:38 AM
Khushboo Jain
Khushboo Jain - avatar
3 Answers
+ 10
Keywords are reserved words in programming, i.e. a sequence of characters which is already defined as an identity of a specific instruction in the language. Identifiers are any sequence of characters which may or may not be predefined in/by a programming language. Identifiers can be defined by programmers at/before compile time. Keywords come predefined in the language itself. Keywords cannot be used as identifiers for other purposes (e.g. variable/function/method naming).
12th Oct 2017, 4:44 AM
Hatsy Rei
Hatsy Rei - avatar
+ 15
The following is C++98 keyword list (60 of them) [http://www.eng.famu.fsu.edu/~haik/met.dir/hcpp.dir/notes.dir/cppnotes/node29.html] Plus, This full list including both C++98 and C++11 and ambiguous keywords altogether. [https://en.wikibooks.org/wiki/C%2B%2B_Programming/Programming_Languages/C%2B%2B/Code/Keywords] Plus, Microsoft specific keyword list which has a lot in common with former one. [https://msdn.microsoft.com/en-us/library/2e6a4at9.aspx]
12th Oct 2017, 5:43 AM
Babak - avatar
+ 2
Keywords are reserved words so cannot be used as identifier, but in case sensitive languages, in which keywords are generally in lower case, so you can use uppercase name of keyword as an identifier. e.g. int is a keyword but INT or Int is not.
12th Oct 2017, 6:35 AM
Lakshay - avatar