Tokens in C
Tokens are the smallest unit of the C program. The compiler breaks a program into the smallest possible units (tokens)
and proceeds to the various stages of the compilation.
Before moving forward don't forget to check our previous post on "Introduction To C Programming".
Tokens are divided into 6 different types and these are:-
keyword, Operators, Strings, Constants, special symbols, and Identifiers.
1.Keywords:-
Keywords can be defined as reserved words or predefined words
which has some special functionality. In C there are 32 keywords present.
And these are as follows:-
2.Identifiers:-
Identifiers are those who identify. These are basically name given
to any element in a program. For example name of variable, function, etc.
The identifier is a user-defined word. It can be written in both lowercase and uppercase letters.
It is a combination of alphanumeric characters. It can contain the underscore character.
3.Operators:-
Operators are symbols that perform some operations.
There are different types of operators that perform various operations.
Some of these are follow:-Arithmetic Operators(+,-,*,/,%),
Relational Operators(>,<,!=,<=,>=,==), Shift Operators(<<,>>),
Logical Operators(&&,||,!), Bitwise Operators(&,|,~,^),
Ternary or Conditional Operators(?:), Assignment operators(=,+=,-=,*=).
4.Constant:-
A constant is a value or variable that can't be changed in the program,
for example, 10, 2, 'a', 5.32, "Hello" etc.
There are two ways to define constant. The first uses
const keyword(eg. const float PI=3.141) and the second uses
the #define preprocessor.
5.Strings:-
Strings in C are enclosed within double-quotes.
The string represents an array of characters. Example: char nm[10]=” Hello”.
6.Special -symbols:-
In c there are special symbols that have some special meaning and cannot
be used for any other purpose. Example:-{ },[ ],( ), etc.
0 Comments
Please do not enter any spam link in the comment box