Keywords and Identifiers
In this tutorial, you will learn about Tokens
(keywords, identifiers,
Strings, Operators), Character set, etc.
Character Set:-
C has the rich set
of character that are Litters (A-Z), Digits (0-9), special character ({}, [], ,
.,etc).
Letters
Uppercase: A B
C-------------------X Y Z
Lowercase: a b c--------------------x y z
Digits
1 2
3 4 5
6 7 8 9 0
Special Characters
|
+
|
<
|
>
|
.
|
-
|
|
)
|
(
|
;
|
&
|
:
|
|
%
|
}
|
{
|
#
|
?
|
|
‘
|
$
|
[
|
]
|
“
|
|
^
|
!
|
*
|
\
|
|
|
|
_
|
/
|
~
|
,
|
|
White space Characters
New line, Horizontal
tab, Carriage returns and black space.
Tokens:-
As we know the smallest
individual units in a program are known as tokens.
C has the following tokens:-
- Keywords
- Identifiers
- Constants
- Strings
- Operators
A C program writing using
these tokens, white spaces and the syntax of the language .
KeyWord:
They are reserved
identifier and cannot be used as variable names. The keywords in C are:-
Keywords
of C
|
auto
|
double
|
int
|
struct
|
|
Do
|
if
|
static
|
while
|
|
Default
|
goto
|
sizeof
|
volatile
|
|
Continue
|
for
|
signed
|
void
|
|
Const
|
float
|
short
|
unsigned
|
|
Char
|
extern
|
return
|
union
|
|
Case
|
enum
|
register
|
typedef
|
|
Break
|
else
|
long
|
switch
|
There are several numerous
keywords depending upon the compiler.
|
Example:-
int ashu;
Here, int is a keyword that indicates ‘ashu’ is a
variable of type integer.
|
Identifiers:-
Identifiers refer to
the name of variables, function, array, and structures etc, created by the
user. They are fundamental requirement of any language. Each language has its
own rule to identifiers. Some rules in C are given below:-
- A valid identifier is a series of one or more letters, digits or underscores characters.
- Neither spaces nor punctuation marks or symbols can be part of an identifier.
- Only letters, digits and single underscore characters are valid.
- Variable identifiers always have to begin with a letter.
- They can also begin with an underline with letter.
|
Important:
The C language is a case
sensitive language. It means let we have two identifiers which have same
name but one is written in capital letters and another in small is not
equivalent. Thus, for example, the HAPPY variable is not the same as the
happy variable or the Result variable.
|

No comments:
Post a Comment