C-TOKENS:
Each individual unit or element in a statement is called
Token. C language contains different types of Tokens.
a. Identifiers
b. Variables
c. Data Types
d. Constants
e. Operators
f. Key Words
g. Delimiters
IDENTIFIERS:
In C-language names of variables,
functions, labels and various other user-defined names or objects are called
identifiers.
Rules for
defining identifiers:
1. The first character must be an alphabet or an underscore,
sub-sequent characters must be either letters, digits or underscore.
2. No space is allowed in between identifiers and no special
characters are also allowed except underscore. 3. Key Words are not allowed as
identifiers.
4. There is no limit of length of an identifier but some compilers
will recognize only 8 or 32 characters.
Valid Count1 , Test123 , Student_name Invalid 1count , 123test
, Student-name
VARIABLES:
A variable is a data name that may be
used to store a data value. A variable is a named location in memory that is
used to hold a value that may be modified by the program. All variables must be
declared before they can be used. The general syntax of declaration is
Syntax: datatype variable list;
Ex: int a,b,c;
float
p,t,r;
VARIABLE
INITIALIZATION:
At the time of variable declaration we assign value to the
variable is called variable initialization.
Ex:
int a; variable declaration
int a=10; variable initialization
CONSTANTS:
Constant refers to fixed values that the program
cannot alter. Constants can be any of the basic data types. Constants are also
called “LITERALS”. There are 4 basic constants.They are
1. Integer Constants: Integer constants are
specified as number without fractional components. Ex: 10, -20,
2. Floating Point Constants: Floating Point
constants require the decimal point followed by the numbers fractional
component. Ex: 11.23, -2.34 …
3. Character Constants: It is a single character
enclosed in single quotes. Each character has an ASCII value to identify. Ex:
‘A’, ‘@’ , ….
4. String
Constants: A String is a set of characters enclosed in double quotes. Ex:
“abc”, “c-language”, ….
KEYWORDS:
Keywords are reserved words in C language. They have
pre-defined meaning and are used for the intended purpose. Standard Keywords
are
auto const int typedef
break else long switch
case enum short union
char extern register unsigned
continue float signed void default for sizeof volatile
do goto static while
double if struct
Thanks a bunch for sharing this with all of us you actually know what you are talking about! Bookmarked. Kindly also visit my web site =). We could have a link exchange agreement between us! imac service berlin
ReplyDelete