A token is the smallest element of a program that is meaningful to the compiler. Given below are the classifications of tokens:
rnrn
Keywords
rnIdentifiers
rnConstants
rnStrings
rnSpecial Symbols
rnOperators
rnrn
Keyword: Keywords are pre-defined or reserved words in a programming language. Each keyword is meant for performing a specific function in a program. Since keywords are referred names for a compiler, they can’t be used as variable names because by doing so, we are trying to assign a new meaning to the keyword which is not allowed. Keywords cannot be re-defined. However, you can specify text to be substituted for keywords before compilation by using C/C++ pre-processor directives. 32 keywords are supported in C language.
rnrn
Identifiers: Identifiers are used as the general terminology for naming of variables, functions and arrays. These are user defined names consisting of arbitrarily long sequence of letters and digits with either a letter or the underscore(_) as a first character. Identifier names must differ in spelling and case from any keywords. You cannot use keywords as identifiers; they are reserved for special use. Once declared, you can use the identifier in later program statements to refer to the associated value. A special kind of identifier, called a statement label, can be used in goto statements.
rnrn
Rules to be followed while naming C identifiers:
rnThey must begin with a letter or underscore(_).
rnThey must consist of only letters, digits, or underscore. No other special character is allowed.
rnIt should not be a keyword.
rnIt must not contain white space.
rnIt should be up to 31 characters long as only first 31 characters are significant.
rnrn
Constants: Constants are also like normal variables. But, only difference is, their values can not be modified by the program once they are defined. Constants refer to fixed values. They are also called as literals.
rnrn
Strings: Strings are nothing but an array of characters ended with a null character (‘