Now start c
language
Character set :- It is a
group of words, number and expression that is used to develop and run a program.
Syntax :-like any other language “c” also has its
own vocabulary and grammer they are called syntax.
Identifier :- it refers to the name of
variable, function and array it is complete user define names.
Constant
:- A constant has fixed value that cannot change during the execution of
program.
Variable :- A variable is an entity that may be change
during the execution of program.
Keyward
:- keyword are the word that carries special
meaning. All the keyword has fixed meaning it can’t be change. There are
32 keywords in c.
Constant
in c
Types of constant
Primary constant
i.
Integer (%d)
ii.
Real (%f)
iii.
Character (%c)
Secondary
constant
i.
Array
ii.
Pointer
iii.
String
iv.
Enumerator
v.
Structure
vi.
Union
Rule for constructing integer constants
a.
A integer constant must have at
least one number.
b.
It have no decimal point.
c.
It can be positive and negative.
d.
If no sign is there than, it
assumed as positive.
e.
No comma or blanks are allowed
within integer constant .
example :- 425
+898
-565
For print integer we use %d in c language.
Rule for
constructing real constants
Real constant are called floating point constant.
Real constant can we written in two form: - 1. Fractional form
2. Exponential form.
(i)
A real constant have at least one
digit .
(ii)
It must have a decimal point .
(iii)
It can be positive or negative .
(iv)
If no sign is there than, it assumed
as positive.
(v)
No comma or blanks are allowed
within real constant .
Example :- 13.2
-27.8
+12.1
For print real constant we use %f .
The exponential form is use when value is too small
and large . The exponential form are represent in two part . The part
appearing before ‘e’ is called mantissa, whereas the part following ‘e’ is called exponent .
Example :- 0.000342 can be written in exponential form 3.42 x 10-4.
Rule for constructing character constants
1. a character constant is a single alphabet, a
single digit or a single special symbol enclosed with single inverted commas.
2. both the inverted commas should point to the
left.
Example :-
‘a’
‘=’
’+’
‘8’
For print a character we use %c.
Variable in c
Variable
:- A variable is an entity that may be change during the execution of program.
Rules for constructing variable names.
a a). A variable
name is any combination of 1 to 31 alphabets,underscores.
b b). The first character of variable should be alphabet or underscore.
c). No commas or
blanks are allowed in variable name.
Example:-
int a,b ;
float c ;
char d;
A,b,c,d
are the variables ant int ,float and char are data type.
keyward
Keyword :- keyword are the word that carries special meaning. All the keyword has fixed meaning
it can’t be change.
There are 32 keywords in c. We cannot use keyword as word
because we are assign new meaning to keyword, which is not allowed.
All
the keywords written in small letter.
auto
|
double
|
int
|
struct
|
break
|
else
|
long
|
switch
|
case
|
enum
|
register
|
typedef
|
const
|
extern
|
return
|
union
|
continue
|
float
|
short
|
unsigned
|
default
|
for
|
signed
|
void
|
do
|
goto
|
sizeof
|
volatile
|
char
|
if
|
static
|
while
|
Comments
Post a Comment