Search Placementyogi.com
 

C Tokens and Keywords

In following diagram building blocks of the c program are shown.

 

  1. Any symbol that is used while writing C program is called alphabets or characters (Ex. A, b, c, +, *, i).
  2. One or more alphabets can be grouped together to form meaningful words.These meaningful words are tokens.
  3. One or more tokens can be grouped together to form meaningful sentences. These meaningful sentences are called statements or instructions.
  4. One or more statements can be grouped together to form a complete program.

C Tokens

A token is the smallest or basic unit of a C program and one or more alphabets are grouped together to form a tokens.

 Example : if, for, while, sum, add, +, -, /, ++, +=, = etc.

Classification:

 Keywords: if, for,, while, etc.

 Identifiers: sum, name, i, etc.

 Constants: 1, 1.5, 'A', "Hi", etc.

 Operators: +, -, *, etc.

 Special Symbols: [], {}, (), @, etc.

C Keywords

The tokens with predefined meaning in C language is called keywords. Keywords are reserved for specific purpose hence it is also called reserved words.

We can not use keywords as a variable names because if we do so we are trying to assign new meaning to already predefined words which is not allowed. 

There are total 32 keywords in C. 

auto double int struct
break else long switch
case enum register typedef
char extern return union
const float short unsigned
continue for signed void
default goto sizeof volatile
do if static while

 

Note : Compiler vendors (like Microsoft, Borland, etc.) provide their own keyword apart from mentioned above. For example near, far asm, etc..

Banner to LogicGuns.com

Hide Page Information

C Tokens and Keywords

C Tokens,C keywords,types of c tokens,c tokens example,c tokens definition