Tokens in C

Tokens in C can be defined as the smallest individual component that is meaningful to compiler  . In pervious article i told that character set is analogous to "alphabets" just like that tokens are  similar to "word" . Combination of two or more characters give birth to tokens.


Simplest Token for example is combination of two character "\n" , here \n represents newline so it is meaningful to compiler. If we write \n any where in the program , compiler will understand newline. Just like that we have  \t for tab .


There are many types of tokens which are given below with example


1. Keywords

int , main , void , float , char , for, if , else , switch , goto , continue , break , struct, typedef etc

These keywords are tokens as it is understood by compiler have their own meaning.


2. Identifiers 

All naming of variable , function ,arrays , structures, pointers etc

we will learn more about this later.


3.  contants

#define , const etc we will learn more later in respective article.


4. strings

Strings are array of characters like john is array of 4 characters j , o ,h ,n .

They are represented by char name[4]. we will learn later in details about arrays and strings.


5. special symbols

# , * { } [ ] 


6. operator

Arithmetic operators like + - / * , comparison operators like  == ,>= , <= ,!=




Contact Form

Name

Email *

Message *