Responsive Ads Here

Token and Keywords in C


  • 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,
  1. Keywords               (eg: int, for),
  2. Identifiers               (eg: main),
  3. Constants              (eg: 10, 20),
  4. Special symbols  (eg: (), {}),
  5. Operators              (eg: +, /,-,*)

Keywords :

Keywords are preserved words that have special meaning in C language. The meaning of the keywords has already been described to the C compiler. These meaning cannot be changed. Thus, the keywords cannot be used as variable names because that would try to change the existing meaning of the keyword, which is not allowed. There are total 32 keywords in C language.

As C is a case sensitive language, all keywords must be written in lowercase. Here is a list of all keywords allowed in ANSI C.
For example:
     int money;
Here, int is a keyword that indicates money is a variable of type integer. 
Keywords in C Language     
caseenumregister typedef
constfloatstatic while

Along with these keywords, C supports other numerous keywords depending upon the compiler.

Identifier :

In C language identifiers are the names given to variables, constants, functions and user-define data. These identifier are defined against a set of rules.

Rules :
  1. An Identifier can only have alphanumeric characters( a-z , A-Z , 0-9 ) and underscore( _ ).
  2. The first character of an identifier can only contain alphabet( a-z , A-Z ) or underscore ( _ ).
  3. Identifiers are also case sensitive in C. For example name and Name are two different identifier in C.
  4. Keywords are not allowed to be used as Identifiers.
  5. No special characters, such as semicolon, period, whitespaces, slash or comma are permitted to be used in or as Identifier.