

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Tokens vs Identifiers vs Keywords in C++
A token is the smallest element of a C++ program that is meaningful to the compiler. The C++ parser recognizes these kinds of tokens: identifiers, keywords, literals, operators, punctuators, and other separators. A stream of these tokens makes up a translation unit. Tokens are usually separated by white space.
The parser recognizes keywords, identifiers, literals, operators, and punctuators. Preprocessing tokens(like #include, #define, #if_def, etc.) are used in the preprocessing phases to generate the token stream passed to the compiler. The preprocessing token categories are header names, identifiers, preprocessing numbers, character literals, string literals, etc. that do not match one of the other categories. Character and string literals can be user-defined literals. Preprocessing tokens can be separated by white space or comments.
An identifier is anything that the user gives a name to. For example method names, variable names, struct names, class names, etc are all identifiers. In C++, keywords are reserved identifiers which cannot be used as names for the variables in a program.
- Related Questions & Answers
- char vs string keywords in C#
- C++ vs C++0x vs C++11 vs C++98
- Virtual vs Sealed vs New vs Abstract in C#
- C++ vs Java vs Python?
- enum vs. const vs. #define in C/C++
- Const vs Static vs Readonly in C#
- C++ vs C#
- Regular cast vs. static_cast vs. dynamic_cast in C++
- OneDrive vs Dropbox vs Google Drive vs Box
- Abstract vs Sealed Classes vs Class Members in C#
- Regular cast vs. static_cast vs. dynamic_cast in C++ program
- mysql_fetch_array vs mysql_fetch_assoc vs mysql_fetch_object?
- Corona vs. Phonegap vs. Titanium
- Value parameters vs Reference parameters vs Output Parameters in C#
- List vs tuple vs dictionary in Python