Wednesday, 23 June 2010

C Tokens

C tokens are the basic buildings blocks in C language which are constructed together to write a C program.
Each and every smallest individual units in a C program are known as C tokens.
C tokens are of six types. They are:

Keywords    : (eg: int,while,do)
Identifiers     : (eg: main, a,b,c)
Data type     : (eg: int,float..) 
Variables      :(eg: a,b,c)
Constants     :(eg: 2,3)
Operators   :(eg: +, /,-,*)
Strings        : ("g","Rajendra")
Special symbols  (eg: (), {})

//C tokens example program:

void main()
{
 int a, b, c;
 a = 2, b = 3;
 c = a + b;
 printf(“Addition of two no's = %d \n”, c);
 getch()
}                                                                                                                                                                                                   .
where,

main – function identifier
{,}, (,) – delimiter
int – keyword
a, b, c – varialble identifier
main, {, }, (, ), int, a, b, c – tokens



 


No comments:

Post a Comment