You are on page 1of 2

Tokens in C

Tokens are the smallest individual words, punctuation marks, etc recognized by the C language compiler. C language has 5 types of tokens:-

Keywords
Any word in C is either a keyword or an identifier. Keywords are the basic building blocks for program statements. C language uses 32 keywords listed below:auto break case char const continue default do double else enum extern float for goto if int long register return short signed sizeof static struct switch typedef union unsigned void volatile while The explanation and use of each of these keywords is described in the next few topic.

Identifiers
Identifiers refer to the names of variables, functions & arrays. Both uppercase & lowercase letters are permitted, although lowercase letters are commonly used. The underscore character is also permitted in identifiers. It is usually used as a link between two words in identifiers having a long name. The rules for assigning a name to an identifier are as follow:-

The first character must be an alphabet or an underscore. It must consist of only letters, digits or underscore. Only first 31 characters are significant, i.e. if the user enters an identifier of more than 31 characters, the compiler considers only first 31 characters & deletes the others. A keyword cannot be used as an identifier name. It cannot contain any spaces.

Constants
Constants in C language refer to the fixed values that do not change during the execution of the program. C supports both numeric and character constants.

Strings
A string is a sequence of characters enclosed in double quotes. The sequence of characters may contain letters, numbers, special characters & blank spaces. For eg:HELLO! 1987 Well Done ?.....! x A subtype of strings are Escape Sequences/Backslash character constants. They are string s that do not get printed on screen but have their own importance when executed. \a audible alert(bell) \b back space \f form feed \n new line \r carriage return \t horizontal tab \v vertical tab \' single quote \ double quote \? question mark \\ backslash \o null

Operators
They are special characters that are used to perform various operations on program data. We discuss them in detail in the next topic.

You might also like