What are C Tokens?

C programs contains many elements which are identified by the compiler as Tokens.
Tokens can be categorized as
1. Keywords
2. Variables
3. Constants
4. Special characters
5. Operators

C Token example program:

int main()
{
 int x, y, sum;
 x = 5, y = 10;
 sum = x + y;
 Printf (“Sum = %d \n”, sum);
}

From above program C Tokens can be categorized as follows,
main – identifier, which is usually used by linker as the entry point of the regular program
{,}, (,) – delimiter
int – keyword
x, y, sum – Variables
+, = – Operators
main, {, }, (, ), int, x, y, sum – tokens

Leave a Reply