What is Element of C language?
Every language has basic element and its own grammatical
rules. Before starting programming we must to know basic of programming and its
element. Elements C are-
1.
Character Set: The character set that are
used in C program according to user.
i.
Alphabets :
Capital A, B, C, D, E, F,
G……………..Z
Small a, b, c, d, e, f, g, h, I……………….z
ii.
Digits
All the number 0 to 9 are digits
e.g. 1, 2, 3, 4,5, 6, 7, 8, 9,0
iii. Special Characters : Special characters are used in the program for specific task each character has its own meaning in the program just like & used for address, ++ used for increment, [] used for array, * sign for pointer etc.
Character
|
Meaning
|
+
-
*
<
>
(
)
\
{
}
[
]
;
:
“
‘
?
&
@
$
|
Plus sign
Minus sign(hyphen)
Asterisk
Less than sign
Greater than sign
Left parenthesis
Right parenthesis
Backward slash
Left braces
Right braces
Left bracket
Right bracket
Semicolon
Colon
Double quotes
Single quotes
Question marks
Ampersand
At the rate
Dollar sign
|
2.
Escape Sequences: Execution character or escape character represented by two characters. The first character is “\”and second character is from the C character set. Escape character always start with “\” symbol for e.g. \n . these character combination is known as escape character and it is very use full in the c program. C supports some Escape sequence that has its own meaning. Blank, horizontal, vertical tab newline, carriage return, form feed also known as whitespace.
Escape Sequences: Execution character or escape character represented by two characters. The first character is “\”and second character is from the C character set. Escape character always start with “\” symbol for e.g. \n . these character combination is known as escape character and it is very use full in the c program. C supports some Escape sequence that has its own meaning. Blank, horizontal, vertical tab newline, carriage return, form feed also known as whitespace.
Escape
Sequence
|
Meaning
|
ASCII Value
|
Why use
|
\b
|
Back Space
|
008
|
Moves the cursor to the previous position of the
current line.
|
\a
|
Bell alert
|
007
|
Generate a beep sound for alert.
|
\n
|
New line
|
010
|
Move the cursor at beginning of the next line.
|
\r
|
Carriage return
|
013
|
Move the cursor to beginning of the current line.
|
\0
|
null
|
000
|
for null
|
\f
|
Form feed
|
012
|
Moves the cursor to the initial position of the
next logical page.
|
\t
|
Horizontal Tab
|
009
|
moves the cursor to the next horizontal tab. 5
space at a time.
|
\v
|
Vertical tab
|
011
|
Moves the cursor to the next vertical tab.
|
\\
|
backslash
|
092
|
Print the character with (\).
|
3.
Trigraph Character: There is a
possibility that the keyboard doesn’t print some character.C support the facility of “trigraph sequence” to print
these characters. This trigraph has three characters. First two are ‘??’ and
third character is any character of C character set .
Trigraph
|
Symbol
|
??<
??>
??(
??)
??!
??/
??=
??-
??’
|
{
}
[
]
|
\
#
~
caret
|
4.
Delimiters: Delimiters are used for Syntactic meaning in C.that have a specific task in the program.
Delimiters: Delimiters are used for Syntactic meaning in C.that have a specific task in the program.
: Colon used for label
; Semicolon end of statement
( ) Parenthesis used in expression
[ ] square brackets used for array
{ } Curly Braces used for block of statement
# Hash preprocessor directive
‘ Comma variable delimiter
5.
Reserved Word /Keyword: Reserved
Words are that word which are reserved for doing specific tasks. These words are known as keywords and they have standard, predefined meaning in C.keywords always written in lowercase. there are 32 keywords in c language.
for example. auto, break, case, char, const, continue, default, do, double, else, enum, extern, float, for, goto, if, int,long,register, return, short, sizeof, static, struct, switch, typedef, union, void, volatile, while.
No comments:
Post a Comment