C++ Tokens
AS we know The smallest individual units in a program are knows as tokens, c++ has the following tokens
1. Keywords
2. Identifiers
3. constant
4. strings
5. operators
every c++ program is written using these tokens, white spaces and the syntax of the language. most all the c++ tokens are similar to the c tokens.
Keywords:
The keywords implement specific c++ language features. They are explicitly reserved identifiers and cannot be used as names for the program variable or other user-defined program
elements
c++ keywords are following. many of them are common to both c language and c++. The ANSI c keywords are show. Additional keywords have been added to the ANSI C keywords in order to enhance its feature and make it an object oriented
language. ANSI C++ standards committee has added some additional keywords to make the language more versatile. These are shown below
auto |
else |
new |
switch |
operator |
temple |
break |
enum |
private |
this |
case |
extern |
throws |
catch |
float |
public |
try |
char |
for |
register |
typedef |
class |
typedef |
friend |
return |
union |
const |
goto |
short |
unsigned |
continue |
if |
signed |
virtual |
default |
inline |
sizeof |
int |
delete |
static |
volatile |
do |
long |
struct |
C++ Identifier and constant
Identifiers refers to the name of variables, functions, array, classesm etc created by The programmer. They are the fundamental requirement of nay language. Each language has its own rules for the naming these identifiers.
The following rules are common to both c and the c++
1. The name cannot be start with a digit.
2. only alphabet character, digits and underscore are permitted.
3. Uppercase and lowercase letters are distinct.
4. A declare keyword cannot be used as a varibale name.
Some valid Identifiers examples are
number Amount_pay reg1 _data AVERAGE
Some Invalid Identifiers examples are-
6number int reg# 4data AVERAGE no
Constant click here to learn
Operators in c++ click here to learn