Documente Academic
Documente Profesional
Documente Cultură
local declaraLlons
LxecuLable sLaLemenLs
luncLlon (subprogram)
declaraLlons
#n sLdloh
vold maln ()
5tJlob ls o collectloo of
sobptoqtoms fot lopot
ooJ ootpot opetotloos
llke ptlotf ()
No Jeclototloo (empty)
Molo ls oo oJJtess lo
tbe memoty lt moy
cootolo o Joto I
loJlcotes tbe type of
tbe Joto wlll be
JetetmloeJ wbeo lt wlll
cootolo o Joto voloe
No Jeclototloo (empty)
#n sLdloh vold maln ()
vold maln ()
Code SegmenL
uaLa SegmenL
a m l n L h e m m a l n p r o g r a m
Com||er
Checks Lhe
synLax
CeneraLes
codes
Com||er
Checks Lhe
synLax
CeneraLes
codes
Loader]
L|nker]
8|nder
Loads
Loader]
L|nker]
8|nder
Loads
Code |n code
segment
main
Stdio.h
Printf
Data
address
C C
AlgorlLhm Lxample
Suppose you are glven a
seL of mark sheeLs
where each mark sheeL
bears A 8 C or l leLLer
grade
WrlLe an algorlLhm Lo
read mark sheeL and
prlnL Lhe grade LhaL lL
conLalns
1 SLarL
2 1ake a mark sheeL and
read Lhe grade
3 rlnL Lhe grade
4 SLop
#lnclude sLdloh
vold maln()
char c
prlnLf (n enLer Lhe leLLer grade )
cgeLchar()
prlnLf (n Crade )
puLchar(c)
geLs()
#lnclude sLdloh
vold maln()
char c
prlnLf (n enLer Lhe leLLer grade )
cgeLchar()
prlnLf (n Crade )
puLchar(c)
geLs()
AlgorlLhm Lxample 2
Suppose you are glven a
seL of mark sheeLs
where each mark sheeL
bears A 8 C or l grade
WrlLe an algorlLhm Lo read
a mark sheeL and prlnL
lf Lhe grade ls A only
1 SLarL
2 1ake a mark sheeL and
read Lhe grade
f grade ls A Lhen rlnL Lhe
grade
4 SLop
#lnclude sLdloh
vold maln() // readlng and wrlLlng characLers
char c
prlnLf (n enLer Lhe leLLer grade)
cgeLchar()
lf( c A)
#lnclude sLdloh
vold maln() // readlng and wrlLlng characLers
char c
prlnLf (n enLer Lhe leLLer grade)
cgeLchar()
lf( c A)
AlgorlLhm Lxample 3
Suppose you are
glven a seL of mark
sheeLs where each
mark sheeL bears A
8 C or l grade
WrlLe an algorlLhm Lo
read a mark sheeL
and prlnL Lhe grade lf
lL ls A or 8 only
1 SLarL
2 1ake a mark sheeL and read Lhe grade
f grade ls A or 8 Lhen rlnL Lhe grade
4 SLop
#lnclude sLdloh
vold maln() // readlng and wrlLlng characLers
char c
prlnLf (n enLer Lhe leLLer grade)
cgeLchar()
f (( c A) | ( c 8))
#lnclude sLdloh
vold maln() // readlng and wrlLlng characLers
char c
prlnLf (n enLer Lhe leLLer grade)
cgeLchar()
f (( c A) | ( c 8))
Summary
rogram
Maln program
Subprogram
tatements
Lxecutab|e
Non executab|e
rogramm|ng Language
Mach|ne Language
Assemb|y Language
n|gh |eve| Language
tructure
Ma|n rogram
ubrograms
(funct|ons)
8|ocks
Com||ers
Loaders
L|nkers
nterreter s