0 ratings0% found this document useful (0 votes) 85 views59 pagesUnit 1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here.
Available Formats
Download as PDF or read online on Scribd
Pnedse the tod
UMIT 1
yet
rp eogeenay eed
i. Souckure of Q program
2. Compllokien and Pidkirig promases
3. Constants , Variables
4). Saka kypon.
5. Expressions wing oponakoss utc .
6. Monaguig up and ouk pu openakeons
1. Heciswon Matern and byanchung
3 Looping Statements
ce Arrays,
- Inthial zatcon
—Declarvekion
-1D) and Qo CUST AL 3
lo. skywqg
1Q.
\3
- stying Oponakrony
_ skyenig coNeYs
Semple Prgrams
Sen
Seas chins
+ Makstig Oponakcons ,progeane
Skruckuve oF So Cc
Pte ~
Tho genanal shuckuye of Q ¢ Psrgsan
preprowdor divectives
Gilobal declarations
‘une marr (void)
vekwen, oF
aN
3
> Psepsaore, divectiveg telly tha Preprrarnay
to look fox special toda flibvares or prepare
the wde fox bramlateyn als
machine fanguap
D Tha glebat
declarations cra visible to
ak pasts of the Program .
fo) a Sanctions , weluding
divided le ew
local, dofinitton and
dojiciidn Would bo ok
Men can bo
They are
stata mogte . ocak
Sectiosy
Mra hoguining of the: 4 ot
Funckiowy ) which ww! Jolowed f by gtalzment
°
Sechtoyy .
Sqhe aifresenca. bak ween
dejiitton w& enpostount .
SS Declouyakioy — cennotLn.cod tho pmpostin Of q
doka obyeck OF A Sune - Tho mann Tearo,
and Sunct ens
a decleuraken and
fon declaw unig data ocbyects
XS Sor typo. chadecnig .
DA dapiiicn actually sets — avide stovoge
pac cx uidicallés tp Saquanta of Stalament
bo ba camied cub. | ,
G@mpilakon NA Lerten protenses
Qhase awa. oneunly 3% dteps
iD weiking che pregran
2) compile. the —_ program
=>) Erocaking ah
> Fer dotng — thooa steps ,
SF twarye tomponantS
splem ) A kext — editoy
spremblay ond iver.
b Be_UNeY Some_
Namely ox opanatch’g
and the co Compiles
7
>the — editoy A
Urad
modify tho. Prat coda. Co Creole exneh
She compiley
Cran form the
Pprogtom to object vada
!
SOW eg°
Liking pre
and ane hh thak eccy
ne
he erecting ee progam -
|. Propmoena.ng
Q compiling,
3 ileand
jest. ce I corn ;
pate | Speer propre I orien
fost
olgject
ql
~bj
Luke |
7. Eraukehld
Sg reompletien prom. file
: tert-ere }
thak accepls coda, : :
< woth Preproceas Shale
and — pod ca
“Sa pure Som Of 9 coda) aha
Conkougys ®
no feat Statomonts ikea hen:
eepilas 3 tho ¢ complen ao
Hep $i 50m the. ceepts
spsctah file cated a Preprocurey
PrascnMy giv, C progr =
meee ole
Pruiclude estdis > wel cose -
moun >
9 puts (welcome) 5 |
5 -
Program exocstton. .
The exterswh OF © prysam tw Cc. whe
we seus thi progam , anothes, Sie with
extasion -bak = get S generated .
> Aster compiling and senmng thea progran,
wo Siler gee gecenalct and extensions
-Oby and -exe ,
ok) mmeand objech file,
D>-ere wean exoutablo silo,
> when ve compile 2 sun ™mypwg. co
Wo get
my prog.
MY PY - obj
My pw. Se.
Pmweks wh A pwegearn |
DSommenks — arre Stalamenls ut the,
PHA so usbich OTO_ Non emacubordla -
Dakwee. |
ee x /v 7
and oukpuk cponetsts
= ce lok, oy ore by seant
5 soma doko
> Fapukkng ae ° on
and oukpulhing oe pouting t * ct
s “
console. (, dono Ys pounk$
Narnrables) 5
scans (geoma peeiston Newiatlen)s
scans (YW 7a", avok’) 5
li Sorrmmak Pe wson
Son eX
pots Chormas speaset yvarvablos) 5
for ex: poukt (wd va) 3
keyword
praywords ara the Standand wordy on cs
RTH awa sererved words Whth = howe
speao) (reaeuing .
+ AU \oywords ames uj Lowen cang
ex
— cane. counko bseale
Contunne_ choy aeons
dowbls lof aude do
Qoto elso enum
dong slook ee
Sherk: wetwsn
Sieh c wegutet Sjeeop
Ex pod, sgnod Sut ch
void shouck hd,
une 1 unswnod,
come ned : Bo colle etcor of ob phanmestic
chataclers uw ustch the sivsh — chanactey mush nob
bo quunenj ca
% The MAME of the — idontigies Meant wot
bo We kegeoorch ‘
Gollewey while deciding bry
Feiler oiuloy anno
vanviollo Namen .
DMWe. Cyst Meg of Vo Yarsrablo must Rok bbe.
digit os any spec tak chetractor
especial — chareqciosS Such AD ta 4 aoe nok
allowed, excep} under s como
|e vevriable name w caso somitive.
4) Sho dongth os fhe Vorsjoblo, Nemo gq sacaty
can be afwy, bul only Sisdk 3B) Charactes
ame = yecognizad .
s)c e
owe hoyoords ame pok valk varrable. name
Bl
) spac Row speetal Character s,commar
guoter are pol otlocued
oe
Counts , tan_ id, zwse x
Complants
2 Xyz
The Speafic alpha batical or mumorrcof
Naluo that nauent gets — changad — cur
moe ty
J Ma
prermug OF the Uihuctoonn |Venialblos ‘
> program — oparate on cata -
> Voniable Gan idenigiey for a memery
Recaisy . Variables arma q wory OF sesonvinlg
moemosy to hold eye) iN or Gi)
names to thom -
We variable dafiristeon us
Wk selayy = 65000 5
AW vasrables hove 3 cmpestank abbyibule%
4 A data typo trot vw establihad
when tho Vaniakla dy dofenad) - 2.9 lesan,
weal) chasactox
* A name of the. yorsrablo
* A Nelua — thok = con a changed by
anngrung a new Value bo the variable
>In ¢) a vecoviable runt lho Aaclarred
pefeve ak can ho wrod
> varviaba can bo lacked ak tho stax
ef any block of coda. ThA SENVAD Q pursposos,
D>Fivst > UE gwen the cornpiley precsa
Whesmakwo abou: he amount oF Memes y
Mek will bo Quien owen cl Vaniabla
secondly, “uk pw dey — tho vompy lox Lei Hy
a EBT og the aniable .Lom hes
: ot o a
Ege) aS vor
gaka kypon can be broadly closntfeac
«98?
oa ee vy
¥ Deka typa Sizo (bye) Ronga_
chan S —las Fo 1acd
st : — 2 74e3b4yR. FO
"a a ee 2) yA SSby 7
floak BQ 1. eT Sya k [53% be
3. yorerxtoz®
doubla by 3.22507 Kr CO
void 3 \tatbq xie
Voluclery -
TN additroy c has’ 4 type. speettrers
ov modifiers and 3 byepe gralipiar S.
Tha bygo epentfions OTe 2
KSi20 _SpedfiewS _ehest and Long
~ SBN spectfieys
-syred ond unsignad,
Gho wee — rolifters oo
* Type quelisi ss — const volalibe and sorbet .
fre St gquebisiers atken Eno. si2a. OF
Xho pantie doko kypan: *
chee ae two gqucdifes can bo une
win tho data typa mb ; treac. cra short
and ong ,
DS Tha Spectfiar Short, uh feomt of the cab teof
the compiloy that the particulars Variable ub c aeS ee eee
Steve smell uilGgon volluos «
Allowed combuatiom of barre
Mmodtfeas uy co
Beka Lope
che
unsigned choy
stnod clhooy
cite
tansened We
sgred we
shot cht
uns@red — shest ink
Sgnod sherk tnt
Jong ail:
unsigned Long wk
Sgnad — Plone at
Feak
dloublo
ong double
4
dloka types cand
gen 16 Bie compuldx
ai:
hits)
aya ryt)
gb bat BERR
oProgram — stoterrenk wee
statement wa syntactta commu ction
>A v
that performs an action odhon program %
erecuted -
SS AY c paorarh slatemonts ase lesmnalad
witty Sem colon C5)
SA pwqram — statesronk on Ga can ha cloanitied
1. selection staternonk S
Q- stevation stalasnant S
a. Jump stolamank S
og H Declaration
s Expression stole nent
ee compound lola ment
4. lelbeled — stalarmanks
S. Gontrs\ stokarnank
Siffenonk typos
a —* 13
eclarohon 5st a program statement: thak Serves
to He Sanguaga tramplakey
bo communicala
kypa of bho
formation about to nana and
doko, objecis neaded dweeng prgram emacukion +
Eyvesswon Stalaront
An expression Ba Sequence Os oprtakors
cand, opetands tak specttzs — Compukalcwen OF A
Volue,
wah
wD June an expresso . bub
men, Ga Stokerrank -
Compound — slolasnant”
Te db a Sequonce OF Stolaments thal
# AY
may bo bred an a Sinaloa stobemonk of Phe
Comsuctey OF =~ Mewsgont stolerneaks -
Jobsled stalamonks
— ees
can bo wad bo mak any Stalament
moan, be bramfessed 6 the
stolamenk -
ze
so ‘ral cont oh
clolamencé by switch
contes| stolarmant:
st a Statement j whith — dekerrmeng
flow OF conol un a program. |
z
the,selection Stalasnants 1 I et
ake celects posti cube exaruktore
path Foor & eck of cra WH MNS odkornabivey
ee en else — Stallanant -
Stevakion skalarronks
Vesa Slalasnanks va. una to execuila Q
grup OF PH OF HESS ctolarnonk S xopeatedly
ex. while » fo and do. whrda
Sump Stalasnents
Ze commen an unconditwral Yemp bo Soma
other place oF HO Geeta . goto Stalameat
Selly .
4
wyManaging cape ond oukput operations 1s
Baric scsaan and “\tauboad Zlo wie Low
© poudon several Function thek Que
' Aeggerank «sds OF NB and pvp AE
Capelility .
x. stddn + Connectsl — Eo he hoxlooous A
%skdoul | Lonreclod ko the seseen
Aether : wnneclad to tho Semeon.
he, Follaroueg a deka shams ce
awaitabla. of menos laneod compekess - Buk
nol of MIA. ‘ob
KSA QU + conrecisd to tho Sisst sew
Communication we
y%stdprn : comneclad bo ho Sivsk poss attol,
pon ken, Posk -
> We stds. > hssdor Silo, bonrann’ bho
Nous ekow> declsrokenn — MEcrneescs for tha
Sunckeny
5 qha npae| curpak Suncitoriy howe Ewe
Cakegori er -
s& Non Soxmotited —-seoch. Comput and duiplay Coukput)
Sunckons -
% Formnabted soak Conput > and display Coulpud)
Sanckoom «4
|
:
a ee eEeeEEEeeeee eee
Tee Seuatlt np anh auth eS
ab can handle ore charactes ab a
dunn. For Kho npue forces does nok
vequive to be pooorad —eftex tha. enhy
of whe chavactey -
S for oatprt functeoms , ae peaks a singlo,
on he. Con:
charactor
ewgle chenacter mpi ond owe
A numbas OF Sancta poovidko Soy
oviensd unpule and oukpuk -
charactor
Somat
The doclawaton
Wk gotcha (oid),
cats gubchas Cate SD 3
5 pte BON input Sunctesip Ehek ready
aA mput
a ete chor ack or feory na 9 ‘Suanchort input
— oukpue Suncetwh thak uosites
-> pakchas wd an
a swdlo characte, on Hho standard ovtpak
dovica )» Be dd Ploy
Soret cee le functor» gees ey &
parsc> thak asso unad to wea and voribe
Shugs fron and to the houpoasd and by
gesnon .
Sud plays Sema —-veopectively ,chasacter anpue Vy
go sead Ot sung lo. chovracher Srom the
genoxal Sor OF the stesamant
Suncton 3 gwen
*sarilo
og hoa A ) re
gokchevs ©)
uaad to cath the
om Sollrvos
chovt _xantable = gokchoy cys
->Mre — getchas unpae functe? 5 e coi Moy
thy, oronactet dak a entered ,through the_
\eeuporsd and — placa Re cy Es Gataad) leet
attotkat co Me yootialle char -variable -
Gre. Solow) toda
Ae oN oha O|
= aakchoy 6
> oun i “ hawactot scead S50 the eyo
ua the Dude uke 5 tthe yoniaalo © ch,
guns. chasactes oukpe
> eukchar ° writes & cher actos co the.
Beg | cone temeam
> ensuccer? puchar wekurny Khe chewattes
> on esrort pukeher sewers EoF
Sho gpronck Sos D
puch (chase _vastable) 5
gt eg bytes attested
ee . £1
chegecnone, foo a I ghoradios
Hw Stewed Uy howen
percha Ceh)5 2 chesackas A pooled on
dho Ssemean .
eeAddiorias
Suncton a8
—
sergle chawactos unpuk end outpile” .
getchey > dhis unpuk — Sunctwd seads, without
echong | on tho Sevoag , a single, chasactey
SIN Ne. keyboard and mmediakely sekusny
thak characte, oO tho prgsagn.
gEnotak — Lorry
ch =gekchey',
Bekchec) S shy wmpuk Funct seads j wilh
echo on the = Sevoan pa Single chasactey 4som
the hoyboasd and mmodiately wekweny thal
chasactos bo the peogram .
genenal Sesry
on = gekcha oO,
parche> Sunctoy writes tha
davectly to tho Scmoon .
characte,
on succeay tha — functeon prbches wobusy
pouiled . On essox jak vekturny
EOP. General SB Lose
the Charrackos
pukch (ch) 5
when 3k W Unrad
tH PeEgraws , tho
above Lunes
saguise the hacdoy
file word to la UWcludod |“Formatted ‘uipwt and oukpur functor 19
momenee ‘Ap oie
SEONGFC) function urad tO weed Soxmattad
doka, Seon — tho reaboord - The sy nto oO
Scan ¢ C8 contra sheng \ argt) aga .-: aan) ;
> tonhel shug — apecitids type and fotmel
of tho Gata to lea. oblamad oom tho ray boovtd
The postetype A
LExToain) Croditon} Egre
Sf a an opreoped orgumon
= widiih Gan opreenal asqumony hak speditws The
maximum pumas of cheracters bo ba read ,
- snodtcan 3 am opteerial oveguarek j which modi fas dha
Aypo Speedy aw Ch,zes Ly
hh for Shore unk |
Tw fey dong uw |
nod for done dole - |
Type Buodifone wapel |
Le suple chow actey
| Ya, Yd Ube gon Volvos
YESLF 79 Floakeng — pore Velira_
| Lo Lox octal numbo!
7.8 saqyene 06 Shug
1 ZO fos vasansd wank
7K homa decimal value
wake
ot Sean RAZ yg, anum >»
| PESO
, Fhe pak funcesh 4 wad fo clus plecy
the ut formake'y regres by the W301
| Pe paats Com sunken |
ee Dertp CO conrsel sheng, oe) a cg a) |The!" prostypa’ Aaslersten :
1 legs} Loidin L-pvecisei’) Dreditea] tone
shu tmasl bogs with 97) S49,
Seach woteul
gields ore optoral
5 Hegs, width » preciste) »
s Steak X= BIOS ,
ranks 7") (slalelo| -| 7] 6]
poars ( Ze$" XY) CP Jala]o Jol -| ae x](
operators and expresses ay Lee
oes
symbek thok Spect{tas
An — opanekox wn :
nccladcosad oparationy
tro. grothamelicad » degi cod ) os
to ba perfowrad
Aho clans $izokwon OF opontator S wie
Asitiernetic = oparakots Wc
Nsvomatic OPA S ;
Bee om F ee OF anivnrnoric, OPSTALNS
vac Shey aro. BUOY, , ENON and bemasty,
Binal oponakors sy C provides F basic anithmale
buiony — oparators -
eines ome example
+ Add! 1244.4
- subkractten 8-48 4
a Mali pli cakion, Qxzy
/ divisor A]a.c
x.
Rarnan' don 13 %2 Ilsives 4rernarn cton 0%) 7 th :
Except Se a mit of AGiar
an
opt
apontalesS can — eecceP'
cstitveete — OP™
poiands
and we ct
openaters > Tho unatg S~ ' openoley
NAN
© ni rand
reget o> ne Nabiio 8 § Ws Op
~ Anpihon gqroeep oO nog oponct as
awatahle, He UO
annt mcsesnont an decnasront opsrator,
cme uneny “++ "! and * —~" opeiabts
cpeme moar docsomonk the ov wy
Naniable by :
Vore+ DS tu & post memament>
tivet > pre wWeseemoanl-
Boric nulen Gor asing a+ and —— operates
% The opsiand pust bo 4 Voantable
buk nok a cemtank oF an expyession |
* Tha opatatoy +4 and __ may precoad
or succeadh the. oparend ,
Bee ieee
Saf sk a pre openates | tha velo
of the opmrand = ty leramontad byore ak
YW fetched for tha
fornputatron
> when the Opanatoy & placad eyters tho
Oparand , the Nalue of tha cparand hongad
ates sk UWrad | °23
> C psuid Shc selakwnal opsiaters foy
compucene} Dumostic ZUantitwis -
~> Relatosiob opaiakors Volyala tol,
~wepsancnting tho, Kua ouktoma.) os © 4 epreascatig
tha fala outcome.
ee) acteoty exomple.
= Eequok sats [* aves teh
Sias Hauer o%f
- VW
= wot equak
2 ein 6 6.5 Peawes 1)
fn Joan Wren of eqpoh «= S SES 1 gwkos 1%
> gseals Shan goss Fou OF
Se qooatsn dhon os each Gs>es [FIMO IY
> The selckwie) oporctors, crould rot ho wach
Sox composi srg
dogicd opmatess SS
5 C guides 3 Segicad oporalers He
Sovmuna, — Sogicad expression
> Like ‘welakiodah — oparrbers, Logical oponas
evaluated b© | oF O-
os => oce pagakwh Ga unary opmabar
2 A 7 s
vt Tat eerie/ 4 on
> dogicad ® AND producon O 44 ONO ay.”
Yor ats opotands — eyadue, FO 0, othetwi so _
produc 1
> dogi cal oR porducon ob, 4 bor aly Opariend
evaluate Lo 0. othoswiso de: produ cos 1.
opsrakos Action excepto. Panu
\ Jogiecd cagakiop 1 (s2=5) °
ze dogical AWD BL a2 646 °
\ dogicak oR & 2b\\ 645 1
Ribvise opmakors oh C
< goovidon 6 bitwise eparalers for
Maas pubakig We Wdividuch bits Gi an Hlegey
gpeatity, .
WexOkox acken Somple
= Biwise pepkon
3 Bikwisea And
1 Bitwisa oR
x Bituise Beloive og
“& Bitwise. My shigte
> Bitwise Pgh sha:
We gpranal = Losin OF Ka ehL shyt anc Myl
gig lebron
Newsies — nesna SD cumboy of Kit posibiony
Noniaile name & neuslaox of bk postion .
2———
Ss
Assenmank — Opanrckor 2
he gonanol fern Of eargnenont: Stallimoat
g
Nasioble. namo = eupsessen >
Sey example
Leo by
Ataris
oonignmonk Opanaked can ha. divrelad enly
Aiea, lypon
Dsumple ospgnmont - > =
Q) Compound — araunmoat
AS pS aks Je yp MEP RSIANG,
S)eupwessien 209 § NMa_ I
A = 5+ Co=84 Co=2y -y
She compound — a@angnmonk —-erpvessund
a Frag wonky Neco y wy compuker¥ pry
ko trae == Bo ¥nrnosik Sur AD
nenas
can ba elno written cy
axr=5
N*=5
nj/=s
Ny=S 5
example
Huvcludo Letdw-hS
me mari C)
F cae Cte epi See neo eos
a 2_ —
F
—
—
enamel
Wocnet 7
Yaz ae
Posesi 5
Z aed -ly
4
pres OYSQ ae yd boyd eax dend,
Ay b, oe, ADS
veklurn 0}
2
outpul:
AeA bay es a= 4
> psiosits OF FHA aang nment Oponaboy
ko ha Dowes han tha priowtws of all the
ors\Ynrnay cc Openekoy S
Sex enomple_
Ks rKstyes )
Tho products ABs anh eS CMA
evoluabed — fivst, bho sum 6+ o
enpuiah — out , Levatly tre aaagynmank of Q6
Wy mada to *.
ne
)
2
Keak CBA) *SY us
“210 5Mionditwiot oparahor as 24
Tho cwnditerial operates has 3 expression).
Te han tre — gern §— Soven.
expresso | 2 expression | expresstop 8
& evolluated » He vs bwoolad
Fissk express |
aD a Jogica conbitton .
4§ tre senulk & non Zero, tran expression Q
& eraduolsg and th value WB bho fural soot.
Otheswise, expression 3” i evaluated and Wh value
& Ye Siwwal — -wenubl.
oh, wk mal, HQ mA J
mh a Cm enim if) 3
puma | renoes
Ghis operates allows, tho Qvaluat cori og
srt ply expressios , seporahad by the comma ,
Foor SAE bo sgh ety onlay and Era evolualad
Value of the Wghk Mosk expression acceplos
A tha Fuial, Sodus: -
Tha. geratoh Sogn 09 Cupuession “aly
comma, oporokow w
expression Wa (euprosnioi 1, exproontcnQ) .- 6.
exprornton 0)
whore o- =
XP GOMDeND awe. valuatss ~
to o . Shiely Avot)
diye Frye ond iy valiuny divcenrded) cmap dey dheSizeof opmiakor
5 se ead for Coleulaking be Si2a. op
deka Mein os type.
Sst thoy A sale oponand thak mey toa.
a taupe nema oF ON expression and. sears
the clze of Hho Speette annity i Ryko:
Huidada 2etdth 12
| We wean C)
g
= yarpytest, si2e0r Cehan)),
pouk¢ Cichor Size
= 7.a& bytes", a\2a0g (short);
prenk § (usher size
wekwen 0)
3
ol
== cha, size =! byte
shosk Size =? byker-
Expression Evalluabied) - precedents & atyectativihy
when Move ts move then ONO oparatoy
jak wd the selakve.
ocetuseng uA an expression
Piovit’, of tho opanakors SAY ssespect to
exch otha, thet with Aokenrmn che ordar
vill bee FT .
precadanca A
whith — hee expression
prioky \enson\ as
> the poocadence, eS operators Aokesminas
ice eee
geo eNaUKEA: Th priosty B Kroon
Prerodonca .