Tokens and Reserved Keywords in C language
Tokens and Reserved Keywords in
C language
Keywords are pre-defined words in a C compiler. Each keyword is meant to perform a specific function in a C program. Since keywords are referred names for compiler they can’t be used as variable name.
C language supports 32 keywords which are given below:
- auto
- int
- const
- short
- break
- long
- continue
- signed
- double
- struct
- float
- unsigned
- else
- switch
- for
- void
- case
- register
- default
- sizeof
- char
- return
- do
- static
- enum
- typedef
- goto
- volatile
- extern
- union
- if
- while
Tokens:
C tokens are the basic building 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,
1. keywords (e.g. : int, while),
2. Identifiers (eg: main, total),
3. Constants (eg: 10,20),
4. Strings (eg: “total”,”hello”),
5. Special symbols (eg: (),{}),
6. Operators (eg: +,-,/,*)
C token example program:
int main()
{
int x,y,total;
x=10, y=20;
total=x+y;
printf(“total=%d\n”,total);
}
where,
main – Identifier
(),{} – special symbols
int – keyword
x,y,total – Identifiers
main,int, x,y, total,{},() – tokens
Labels: c language


<< Home