Tokens -
Tokens are the smallest individual unit of a program . C++ generally has following tokens
1] Keyword
2] Identifiers
3] Literals
4] Punctuators
5] Operators
1] Keywords -
keywords are the words that convey special meaning to the language compiler they are also known as reserved words few examples of keywords are - asm ,auto ,if, else, etc
2] Identifiers -
identifiers are the fundamental building blocks of a program and are used as a General terminology for the names of a different parts .there are several rules for writing an identifier as
a] an identifier must be started with an alphabet or an underscore.
b] blanks are not allowed.
c] special symbols are not allowed.
examples of a valid identifier in C++ are - my_files ,saucom99 , Saurabh , A5 , _ABC
3] literals -
literals are often referred to as a constant and are the data items that never changes their value during the program execution .there are following types of literals in C++
a] Numeric constant
b] Character constant
c] String constant
d] Bool constant
a] Numeric constant -
a numeric constant must have at least one digit and must contain one decimal. It may contain plus or minus sign a number with no sign is assumed to be positive commas cannot appear in between.
b] Character constant -
character constant is written within a single quotes and its size is One byte that means it contains single digit or single character.
Tokens are the smallest individual unit of a program . C++ generally has following tokens
1] Keyword
2] Identifiers
3] Literals
4] Punctuators
5] Operators
1] Keywords -
keywords are the words that convey special meaning to the language compiler they are also known as reserved words few examples of keywords are - asm ,auto ,if, else, etc
2] Identifiers -
identifiers are the fundamental building blocks of a program and are used as a General terminology for the names of a different parts .there are several rules for writing an identifier as
a] an identifier must be started with an alphabet or an underscore.
b] blanks are not allowed.
c] special symbols are not allowed.
examples of a valid identifier in C++ are - my_files ,saucom99 , Saurabh , A5 , _ABC
3] literals -
literals are often referred to as a constant and are the data items that never changes their value during the program execution .there are following types of literals in C++
a] Numeric constant
b] Character constant
c] String constant
d] Bool constant
a] Numeric constant -
a numeric constant must have at least one digit and must contain one decimal. It may contain plus or minus sign a number with no sign is assumed to be positive commas cannot appear in between.
b] Character constant -
character constant is written within a single quotes and its size is One byte that means it contains single digit or single character.