WHAT IS TOKEN?
In
a passage of that individual words and punctuation marks are called tokens
similarly in ac program the smallest
Individuals
units are known as c tokens.
C Tokens have six types of tokens.
C
tokens Variable....
- Keywords
- Identifier
- Constant
- String
- Operations
- Special symbolic
Keywords
Every c word is classified as either keywords or an
identifier all keywords have fixed meanings and these meaning cannot be changed
building for program statements there are 32 words defined as keywords these
have predefined user and cannot be used for any other purpose in c program they
are always written in lowercase letter the list of these keywords in given In
table.
Auto
|
Double
|
Int
|
Struct
|
Break
|
Else
|
Long
|
Switch
|
Case
|
Enum
|
Register
|
Typeof
|
Char
|
Extern
|
Return
|
Union
|
Const
|
Float
|
Short
|
Unsigned
|
Continue
|
For
|
Signed
|
Void
|
default
|
goto
|
Size of
|
Volatile
|
Do
|
It
|
Static
|
while
|
Identifier
Identifier refers to the name of variable. Functions and
arrays. These
Are users defined names and consist of a sequence of letters
and digits with letter as a first character both lowercase and uppercase are
permitted
Constants
Constant In C refer to fixed value that do not changes
during the executing after program .C supports several type of constants
illustrated .
Type of Constants
1) Numeric constant
- Integer constant
- Real constant
2) Character constant
- Single
character constant
- String character constant
Integer constant :-
Refers to a
sequence of digits.
There are three types of integers, namely, decimal,
integer, octal, integer consist of a set of digits 0 to 7.
Hexadecimal
integer consist of a set of digits 0 to 15.
Real constant:
represented by numbers containing fractional parts.
Single constant :
contains a single character enclosed within A PAIR of single quote mark e.g. ‘X’.
String constant :
is a sequence of character enclosed in double quotes e.g. “hello”.
Variable
A variable
is a data name that may be used to store and holding data a value a variable
may take different values at different times during execution
Rules for
declare any variable name
- They must begin with a letter.
- ANSI standards recognizes a length of 31 characters however length should not be normally more than eight characters.
- Uppercase and lowercase are significant, that is variable total is not same as total or TOTAL.
- It should not be a keyword
- White spaces is not allowed
Post a Comment
Please do not any spam link in the comment