Wednesday, 19 August 2015

Tokens in C++ Language

Tokens in C++ language:

Tokens is a smallest individual  unit of a program .

In c++ language have  followings types of tokens 


  1. Keywords
  2. Identifiers 
  3. Operators 
  4. Constant 
  5. String 
  6. Special symbols 

keywords
keywords are reserve word in a program which meaning reserved in compiler.
in c+ language has 48+15 key words.

Identifiers

Identifier refers to name of variables pointers functions structure union etc.

Rules for naming Identifier :
  1. Identifier  can not be numeric and can not be start from numeric 
  2. Identifier can not be any special character or can not be start from any special character.
  3. Identifier can not be keywords. 
  4. Identifier length can not be more then 32 character long.
  5.  Upper case and lower case letter are distinct. 
Operators:
operators are the symbols that used on the operands for the specific purpose.
like 
A+B
where A and B are the operands and + is a operator .

Constants 

Constants refers to a fixed values that don't change during the executions of programs.

like:
234 integer constant 
34.9 float constant
'A' character constant 
etc. 

String:

String are the collections of the character enclosed within double codes.

like:
"sheikh"
 "abdul"
"mateen"

 Special Symbols:
~`!@#$%^&*()_-+={[}]\|:;"'<,>.?/

No comments:

Post a Comment