What is tokens ?
Tokens are the smallest individual unit of a program . One or more characters are grouped in sequence to form meaningful words .these words are called tokens
Types of Tokens
- Special symbols
The words that are understood by compiler is called keywords. it is a predefined or reserved word in C library with a fixed meaning and used to perform an internal operation
Suppose we write rach it is not meaningful but if we arrange rach====>into ==>char==>Identified by compiler===>i.e ==> keywords
There are 32 keywords in C
Identifiers are the names given to variables, constants, functions and user-define data while writing a program . It consists of sequence of one or more letters or digits along with “ “
Suppose we write reaa it is not meaningful but if we arrange reaa====>into ==>;area==>Understand by programmer i.e identifier
Rules for an Identifier
- An Identifier can only have alphanumeric characters(a-z , A-Z , 0-9) and underscore(_).
- The first character of an identifier can only contain alphabet(a-z , A-Z) or underscore (_).
- Identifiers are also case sensitive in C. For example name and Name are two different identifiers in C.
- Keywords are not allowed to be used as Identifiers.
- No special characters, such as semicolon, period, whitespaces, slash or comma are permitted to be used in or as Identifier.