Tokens in C language | What are the C Tokens ??

Spread the love

Tokens in C programming Language :

  • C Tokens are smallest Individual unit of a c program. Tokens are Building blocks of C program.
  • A C program is Collection of C Tokens.
  • Token can be keyword,operator,separator,constant,Identifier..etc..
  • We can’t split the Token because token is smallest block of C program. here is a example to understand the C Tokens.

Example Program 1 : To Understand the C Tokens :

Output :
Welcome to Sillycodes.

We know that any program will execute without any errors. in the above program we have many tokens,
those are

  • void is keyword and one token.
  • main is Identifier and  it also one token.
  • printf is function it is also one token.
  • return, {, }… all are tokens. A C Program is Collection of Tokens.

Note : We can’t split Tokens.

Example 2 : To Understand C Tokens :

Output :
Error.

If you see above program, I try to divide the token. but i got compilation errors.. Because Token is the smallest Individual element in C program. we can’t divide it.

Note : We can’t split C tokens but we can have any number of spaces and tabs and newlines between two tokens.

Example 3 : To Understand the Tokens in C programming :

Output :
Welcome to Sillycodes

From above program it is clear we can have any number of spaces, tabs.. between two tokens. but we can not split a C token. because C Token is the Smallest individual Element in C program.

You Might also like :


Venkatesh Macha

Hi Guys, I am Venkatesh Macha. I am a programmer and an Open Source enthusiast, Presently working as a Software Engineer. Apart from that, I love to explore new technologies and things.

You may also like...

Leave a Reply