Tuesday, May 12, 2015

Tokens

Tokens
The  Collection of a valided character set in “C” is called token.
Types of Tokens
·         Keyword
·         Identity
·         Constant
·         String constant
·         Operation
Example:
·         Keyword :- It is predefine word in the library we cannot change it during the programming.
                Eg:- int, float, char, long, double, switch, case, break, auto, else, if, for etc.

·         Identifiers :- It can define as a programmer define element like the name of variables, function, arrays. Rules for naming the identifiers :-
1 .  An identifiers is any combination of alphabetic digit or underscore.
Eg:- int a@ (*)  int a# (*)

2 . The first character In the identifier name must be an alphabet.
               
3 . No, comma or blanks space are allowed with an identifier.

4 . Length of the identifier depend upon complier.

5 . No special symbol other that under score can used.

6 . Upper case & lower case are dishing.

7 . A keyword cannot be used as a identifier.

8 . Identifier should be unique. Same identifier name cannot repeated with in a scope.

·         Constant :- It can be categorized in two types. It value doesn’t change during the programming.
 Type of Constant :-
1 . Literal constant :-   Directly used constant value is called literal constant.
2 . Symbolic constant :- Rether than using direct value we can created symbol to the literal constant by using # define directive before main () is called symbolic constant

No comments:

Post a Comment