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

Chitra
Chitra

Leave a Reply

Your email address will not be published. Required fields are marked *

Get the latest updates on your inbox

Be the first to receive the latest updates from Codesdoc by signing up to our email subscription.

    StudentProjects.in