Characters Sets, Keywords and Identifiers in C Programming
C Language Jalandhar
Character Set in C Language
C have the rich set of character that are
Litters ( A_Z and a-z) , Digits( 0-9)
special character (/ , \ ( ) [ ] { }
etc), C can process the 0 – 255 characters as data or as literals.
The
Complete Charter set is given in table (1.a).
Charter
set in C Language-
Litters ( A_Z and a-z)
|
Digits ( 0-9 )
|
. periods
|
, Comma
|
; semicolon
|
: colon
|
?
question mark
|
/
slash
|
\ back slash
|
~
tiled
|
% per sent sign
|
_ under score
|
& ampersand
|
*
asterisk
|
( Left parenthesis
|
) right parenthesis
|
{ Left Brace
|
} Right Brace
|
{ } Curly Braces
|
[
Left Bracket , ] Right Bracket
|
Table 1
Tokens in C Language
As we know the smallest individual units in a
program are known as tokens. C Language has six types of tokens that are
following given below- :
ü
Keywords
ü
Identifiers
ü
Constants
ü
Strings
ü
Operators
ü
Special Symbol
A C program writing using these tokens, white
spaces and the syntax of the language.
Keywords in C Language
They are reserved identifier and cannot be
used as a variable name,or other user define program elements. All keyword have
fixed meaning and these meaning cannot be changed, there are 32 keywords in C
Language, that are given below-
Auto, break,
case, char, const, continue, default, ,do, double, else, enum, extern, float,
for, goto,if, int, long, register, return, short, signed, sizeof, static,
struct, switch, , typedef, union, unsigned, virtual, void , while.
Identifiers in C Language
Identifiers refer to the name of variables, function,array, etc, created by the user. they are a fundamental requirements of any
language. Each language has its own rule to define an identifier. Some rule in
C are given below -
1.
A valid identifier is a sequence of one or more letters, digits or
underscores characters
2.
Neither spaces nor punctuation marks or symbols can be part of an
identifier.
3.
Only letters, digits and single underscore characters are valid.
4.
Variable identifiers always have to begin with a letter.
5. They can also begin with an underline
character (_ ).
6. Another rule that you have to consider when
inventing your own identifiers is that they cannot match any keyword of the C
language nor your compiler's specific ones, which are reserved keywords.
Important Note:
The C language is a "case
sensitive" language. That means that an identifier written in capital
letters is not equivalent to another one with the same name but written in
small letters. Thus, for example, the ABC variable is not the same as the abc variable or the Result variable.
No comments:
Post a Comment