C++ identifiers are names that identify program elements such as variables using alphabets, numbers, and underscore.
Here is the list of characters for:
Any other character from your keyboard that does not fall under the above category is called a special character. The uppercase and lowercase are distinct characters. They have different numeric values according to ASCII standard.
There is no limit for the number of characters used as , but some compiler put limitation by recognizing first characters as name. You should read the compiler documentation to get the information.
Rules for Variable Names
The C++ identifiers are used for variable names. We must learn the rules to give valid names to variables. The names must contain allowed characters.
My_var Table S R
The above are some valid names.
5chair speeed$boat three dimension
The above three variable names are invalid because:
- variable names cannot begin with a number
- special characters are not allowed
- whitespace is not allowed for variable names.
Keywords are special identifiers because they are reserved by the compiler. You cannot use them as variable names and they are case sensitive.
Here is a list of C++ keywords.
Note that sometimes one or more keywords are used together.
Object-Oriented Programming with C++ – 8th Edition
Object-oriented programming with C++, 8th edition is here with some valuable updates. The new edition helps students to assess their learning by answering questions based on learning outcomes. Objective-type questions and dry-run questions are introduced to make students exam ready. A new appendix on interview questions is for those seeking to join the industry. The book is designed for students studying at the undergraduate level. It provides all-inclusive concepts and programs on object-oriented programming with C++ as an implementation language.
- 150+ multi-choice questions
- 100+ dry-run exercises
- 90+ interview questions
- Two new projects and more