C Tokens
C Tokens : Token is nothing but a part of instruction written in a program. For example if program has instruction like
int a = 5;
Then compiler will break this instruction into various parts as int, a, =, 5 all these are called tokens.
There are different types of tokens in C language as follow :
1) Keyword : Every language has it's own predefined set of words reserved for it's own purpose such a words are called as Keywords. Users can not use them for creating user defined members in a program. C language has 32 Keyword they are as follow
2) Identifiers : The names given by user to members of program (like variables, constants, functions etc.) while writing program are called identifiers. C language specifies some rules for defining identifiers as - they should start with letter or _ (underscore symbol) only, they can contain alphabet as well as numbers but no special symbols except $ and _ are allowed.
3) String : A sequence of characters including alphabets, numbers, special symbols is called string. Strings are enclosed in " " (double quotes) always. C language makes use of character array to store string values in memory.
4) Constants : Constants can be declared using const keyword using appropriate syntax in C. Values of constants is fixed throughout the program.
5) Operators : Operator is a symbol used to perform operation on operand. C supports unary, binary as well as ternary operator. Unary operators in C are ++(increment), --(decrement), &(address of) etc. Binary operators include arithmetic operators (+, -, *, /, ^, %) and logical operators (&& (and), ||(or), !(not)). Conditonal operator(? :) in C is a ternary operator.
6) Special Symbols: C also supports some special symbols or characters as token.
Comments
Post a Comment
Please do not enter any spam link in message.