c Language Notes
c Language Notes
Page
Antiicat Language
pHDeslg.ned to communicate unstuuctiang to a machine
3sed to CHate HagHOm9 tAat contual JAe behavioH
ahmachine
2 bes Paag1ammïng_languageg
Piagmamming language'aal
Exampl+
Stad
9Luake ub
bueh y eeth
9 apen Hidge
take mitR.
waum It in m+cHawave.
stah(
obiect ME, abject nidgd
wlakeu) aben(
bugh clogeC)
abject Wau
WaimC)
Baket
9 19 wHItHen
n englrehat 1S witlenn Re Jan
Aabeza
Re Callec
d
generaion ano
uige
hene aHe
Date
Page
IGawice object
Puagiam. Cambilel bag2iam S t doe
hHagiammiho_Clue th HOCealuo
QnbHaooduua cliicuet h ha
becameg vey
uhmatune 9 bu Bi h unchn_a
data ate used
tfhat uhat ojHaediuIral baagan
mament oime- the data
uTtR IRe helb o lacal and glaba vai
handled
-ahles
Disadva ntogés f-
yPanallel oleuelopment lë mot paseible- he_Loling
a kelongentme
e op daum pHogHamming moy dammp ieae teghna-
Smce mathing executable uiPeeven exist unt
nean the endaRe pHojec-
3ALLdecsionsdeend on 3lan fino gaal a he
pMojecand gome deciaCnS Cannat_be maclecle
-þemlipg m hO 9heeiie Raldescafhitm
Lpata Daia
Euncha tunctiioms|
Data
Funchias
OMganizaion_ unchiom and daa h coP
SheneaHO many 9tebe
Gnncdhduat. pHOgKam. un_deuelasmeni
Lised gtebs ufite Fatlcrurihg ane_ many
tcakho a ag&CUn-
Date
Poqe
paogacua
uhplieel usTtA 9npui o See Lhethen the accuA
Me uanS tAe acclLaa Oulpui Qlen laRTn9
e mbub
5MaibtengaceB 9n dRi3 phage paogaam developm-
-ent bMagtam uRich 3 allogefRen nea-
-du nstaled at tRe gite o the u.g
2 lawchat Sumbelg
exmînat an avak Sumbol
P-
FEFR
Pae
Stait
Ma M=0 Padallelogàam
AM-o Sum:al
Gnbul manka
LRee.qubjecisl
Calculgke gum
ISUM M+MatMa
Stab
251aeaBe La chasdhd Re langegt
0mamg9 ua mumbeg Cnlen by Re taeMS
C6PGeudacodeg Paeudacade anatie papufaH
taaf uged opHogaam analysis
and
and blanoing.9 S clean HamRe name
PSEUDO means Jatse and Cade me ans an
nstiuctton_ uHtHen ingome Lambuker langu
langu_
age-t has na giaphiaat GN tabutan Suotax
9talao alao called PDL Paoguam desigh_Lan--
Quage Pgeudacode Canian ollauîng bask
loqico g{HuctuHg-Lch_aue
Date
Paga
8Aduantageg a Paeudocode
Camputey_languag@.
nto pogham.o actuak
Pgeudocodeg ane Helatively eagyto madtu
n Cage qchanae h logic qptogHam
31Paeuda.codes are Helativelyles9 diYe ComSumna
Ran a louchatt_
2aDisadvanlages a Peeudocode
4No Quabh>cal HehHeentatiom i s avaeable NUIA
Pseudacades
Peeuda.cmde is dilieult to undeneiand gan a begihne2
3hene aHe no sfandand Hules uto lenu
n ugng pgoudocodea- It leads to communicahim
oblem ffen Gama_Codes shareduamq
9eudacodes -
Sa Dedigion able - DecSian tableg cleauly and
cancigely deme Jhe gtaiement
abuablem and steps o be taken 9
me oxmoHeCandifomS_ie uieled
Fallaumng aHe iie ghebsto 6e alloued 2on tRe
Camsiuc han o deci9ian table.
h e þHablenm Rat hog to be gof ved
by-
JRe mbulen, must e brigpely cletfned
tau mugt explah U_Com.dttoma iat ane to.
d e dested
aAiable ghoutd beoHmed by-uaihg ua lisks
AILRe CaHeQbOndma aticns b cmditiane
Date
Page
Addta CaunT|
Add nADuT
WHite Outbui
Read mext HeCO Hd!
uHite AAULT
SIaP
Fandamentalso C languagg
S Lofat is c langua ge ?
Ans Cis a cambutexpHogHamming kanguage -C langu
age Heplaced tHadikionma HogHammng languages
lo tkat dfme ike: FORTR AN, PL/I and A*GO
Las develaped uh 192at AT and I's 6ei
JabaHatonleg 0USA, Dennie Ritchie" ig Rnoun !
2Featuneg c C Language-
ALphabetsl Canstants
Digit Naniables naluchions PnagHamnr
Sumbafal KeuuoHdsl
Leanning Clanguage
4Chauacte Get =
Achaacken Can be any alpha-
-bet, digik on sheciat 9umbaf Used to epxes-
enk apíeceo namaicn_
Alfhabeks+ A_ B C yZ
Digiig0,4,2,3 8,9
Skeciot
Sumboles
twa
Hene, ammagaHe used taSepaHale
Sumbots and 9h S also tueated as a
valid sþecial
ALha beisC_(hanactey Set subboHhs aiphabeks
Om A o 7_and 4-z NaBe Hat -
3Shec+atchanackens -
Sn addiHon ta alphabe
and. digiis. Csubbaut ga1 many3peoial
chaaackeys
5IC Tokeng 9n_C language,fe gmallegt 9nd
-viduae Units ane called_ag takOg
lakens *n CaAe o djenent tubes these. |
aHe MepHesenBe d hy belcu g ute
Caken9 5
Keywadd CamStan
uAIte1 |l25;15-29 SinimgS apeHatoHs
CHemant
9denhijie4 Speciat Sy
Tax SaP mhofaCr1
ybes at C akena
Keuwoude.¬vexy Wayd in
o a pHag Ham
CLaguage wiPe be a heywo-
-Hd o_an 9dentrO CQmbfe has
40 heLuodg-Jhe Arsi o Aege_ keyuoHds-
a as olous
Date
Keuwoydg Page
Canstantg
Canstant HejeMs uta a value Hiat
do n a t Change duntng tRe execubion 0
apHagHam bOH Examble malfemahical dem
Pie"s alwayg assumed ube equal lo.
O 8-14.
e 6+ y -95
wee
above examble G, 4, 95 values
neve Change
8 ea_ol CCamatana
Canstants
Numeic Chanacten
Canskantg LCamghanBs
ntege Real|Single cha
JCemekanBe Comgtanisl taaBeh Cmstand StHing-
Ccmstantel
ouhukAunchn
e a c a b e g e g u e N C e g aHe
uaed uñth
chaacteng_has a
9pecith
each q tReae PEusknaked i n jallasig
binpoge Ahey hane heen
table
Canstant. Meaning-
mam nt Meonne Ventical tab
Bell aleit 8fhgle quole
Back spacel
E FoHmeedf Double uake
n' Ney line Questian maak|
CawagE
RetuR
Backslash,
Tab,
hanizontal Null
9anakleg 9n CbHogHammibg a vanabe ig
a_Cmtaïnen (gonage aYea) to hata
dala-Nanfable g a mame,gien to a tempa-
- Hy menOnyLacalian_dñathag been Useo
to `lone any value -(duaing baugdam exeeuhon
Avaxa bleîs needed IE s cleay o m dhe
name fat ualue sioued h vasîabe can be ch--
-anged ot any fnstance Hne aluaihg Ae pio-
gaam Execufionh
Qxamble 51+3y 7
9n aboe equaHon x ahoyare vasiobles, wiich-
can_ hae amyvaku_53124 A_Camtan_
Rules Ha ConstuchianoUania6/e
he ma me Oie vaHiable can o any_am th
hon ol ginglë o 31 lbh0kets , digileenoUnder
- hm
-
Camtezs
eVaufablemame mugt Stat uiB a chaxoclen
Blank 9paces and Cmhmas ane nof alloue d
uiin a yaniable ame
4 No shecial Sumbot,except Re undescoue (A
Js aWowed
b he vatlable name Cannat be same a3any ket-
-uoHd
6: Some examblesa valid vax+able nameo Qre
HY,hem, saloy,HalbilP,hno ek
loVaH*able Declanatiam f- Vauiable ug declaned by using
a gtae ment Rat comtame
Re data type o van+able _and nome qvan+obie
Jhis skaBement Can aleo Cmiain He niHal ualue
ofuafable-Ja xamble jelounnggtalement
aleclanep a vaziasle boeics al nleger ybe
and 9phalces i lo 94c
9ot boSic sal= 34on_
CDala Jyhes
Funda pan vain LDERIuEDl
bmentai delne
S{Huetue Lenum
Uniom
LAxHays3
FLoangchan
n t acley
Float | Cha
insigne d deuble LInsaned
3 re ni naaa LChay
rg
Datatybe 3Bmes
Desclpian
ntegennon Range
3246se Bytes
FHachicmallvaluesl
baf tve andve
to 138 168
PInsignedStones 9ntegeC do 5, 2
gnt nnHactiomaf 535
535
valueg
one hundo
Oatatybe Desciption
Char Stones ChasacBeH Range Bule
128to
yalues
Unsigned| 9tanes Chaaachee ato
cho Valuen 255
Page
4Pan
to data tyhegf- Paimte s a data utyhe
tfat bandle s he dala aA
beH Ute memoy adoduemJafxamble an gnkeger lanais
hatdsanl9neger value haueves Gnleger poinhes halda addoreu4 9akeger lia ai
B|Vaid data tybg Voidl dah tybe epzosenis
emhy On Mull- Jhis datatyée
u uged uRen a baniculan Junchion doeA
Metunn any value
Ccmpited and execuled
7oSee the cutbut Phes ALE ASftcm keyb0a.
6HHOns.in C LangtageEunoe He. Ae buable
aH dffe auelgfRat oc
n ihebHOgham. Shere OHe mainly e 1u
HOHG exist un_C PuogHamoLng
Syotax Eunan
Run hime eiuo
nkeH eHHON
agicaP HHON
15emantic eHHOH
HOgHam o itusbigte
nclude9ldio-h>
varal main ()
nt y 15;
tin"7.d,(1,)
Date.
Page
EHHON
CHHOH exhected; 6eoneJlakeg
Run dme eHHON+EiuonSs wfich OccUH duHmg fha-
-gHam execufiam(Hun-tmolatb
Succeas}u?_Campi?ation aHe called Hun fime
eHHOH s -One the mogt Com man Hun m e
eHHOHJe dvieim bs IeHo al90 knolun ag diiSa
eHHOH hese types o eHHoN_aHe band to fnd
as tie Campfen does mot paînt to JRe Aino qi
ufiph Re enHOH OCcUg Cxoamble q 1untme
eHnon_*S
Hognam uto IPPugtHale
IHun_time eHHoH
9nclude 2gtdio.hbz
aid maln (
lWAanglage
I mum ben is di+ded by O
div nlo
Prah("xe9uft -1d, div);
CHOMlit abþeaM 09
Wanhg divisian by Zeno Ewdiv-by-ZeHo
div nlo-
inti o
! loaical exia 0 SCmiçdm qfey lob
Foma; i49;i++);
pun4("loop"
Contiue
getchar(l
Ket utD a-
int a,b,C
A+b=C llsemabhc eyHan
CHHGH
CHOYualueequned a9 lejtapbeoncd a asanm- N
'nog am t e 1s
Compited ad oxeculed, tAe Compiter generates
Saune ite 9 UilR Same name as tfal o
ogacm ile but Ui did eaentexen s IO
P
Belau) FfguHO shoawa iRe. CampIta Hon byooc
Lu[ Bë Tleg cHeaked at each_9lep
JRe Compitahon bHOCESS
FiHSt FrH9t
rst-CCambite0LinkeN aaden execuhon
SOUHCe abjeet
FTRe
ibHany
Funchang_
FeatuHeg PHaqHammîng f-he mai
Key eatuHep e
CPHaaHamming aHe a9 a-llows
Spee d ( Cames uilA
8uppat aH SueiempHO
QHaming and hence 9t Compilesand
uilh hign Sbeed uaten excuk
cambated wiR affen HIL Language
Fleibiffhy -he Second eatuae
9 iefbieity-
tloxibitityoCaogaamming
mean bhassibititis
pHagammy to Connol Ae language
Modutatly{-1PossibITty
n Srn
o bieak cdown
lange aogpa ns
all moduP
Usthg-3ub-ouline
4 Poxtabitityb-gt is a platfom
-ing longuoge ndekendeni progao
Extensibitaly- fbss uftilto add ne katus_hy
ChapBe-3
abeHQkamS and ExpHegsiang-
OhenalaH9
RelahanalY
apoatoxs Camdi ulssignment
Hmal
pheaan\agical ohenaln1
ifmehe abOnatongC language uph0He dHR
me HfoabeHafiang m VaHable
inHaugh_VaHioug aHifmehio abeHatan3 allnuino
ing
beHlanmaMiKm@hc ab
UHe he apeHalaHa_ta
tgtmg-
4AssiaDmentahenatonG Agsio-
is called Smple Assia-
nment_abeHafaH Clang ua.
l-go t uged to a99ion alueg fa VaHïableg r.
c-9n C langua.eJhe VaH*able_m he lejt hand
Side cRe 099igh ment ahenalon HeCeiUGS R
value_ayaHiable on_expegs*m DH@SONt m
the Hight hand gide c 09eiqDmentapeiaay
taN example gn he expHeSs*D X=55LutP_be glo
a:Ztt
edinvauioble x gn cxpHEg9IcnS
1)
addition-
and DecHement obeHaton9fo 9nStandaid
Hement
Shi
Relahional
Coualuly = =
Buse ANO
BituisoXOR A
Bitunse OR
Logi col AN
logu cal OR && Lelt to 01hH
kejt ta ghi
Condh hiomal Right lo Le
JAs uanmentt-=*=/=/%=>>=- A-l-Right to
LeLla uiphl
CommQ
Examblef-
nelude2gkdio-h>
main (
Sntaa , b =lo,cz15,d-51@7-
e_át6)cld
Paint("Value ol6+6)*c/d ig od \ne)
le fat b*c)ld,-
Pain( Value Ca6)fc)/diszad ae)-
eatL=¢Ld);
PainH"value of la+6) lcfd)Is:ad\nej-
e a+[b*cLa,1a le1s-%d\n
PainyValueefatl6*c)ld s-%dIne-
Outbutuitt_be
Value latb]fc/d îs Qo
Value o (a+6] *c jd*s: Qa
Ualue o atb) Ffc 1d) s 9
Value ef de(bc)/a is 5 0
bote
Poge
9 a + 2cu/1o-3la
lan t 2ao lo-
lan +2o-Ro
PanH"Loautbut is=%d",Hei)
getch -
6oD
PhogHam Jon tA expt©son
9nclude<stdi o-hz
Vna man ()_
Date
Page
E=079=35,pHO7-
clHSCH Q;-
Dea6+Ckdea£-9
bain (" \n authut is =6bxo);
getch (4
3 5 ta-xlo/z t3 5t192-5*-L
5+20/2+13 0 5 9/2 -l0 - /
-5+2 + 3+9 -I
2+3- 2
= lo-_a -8
PHogHam oexbHeMiom e
ncude <Stdia-hz
Vaid main (
9ata- 5,b:2,c=lo,d=1,e=12J=5,9-19,b-9,1-5,42-
ClusCH;
Eloat Xtl-0
Py (x od,Z-% x z )
Oltbut
X= lo 7= j0&-0oB-
2xblicit ube Con vesicm
Highen
Lowey Explicit Jube Data
Data huhe mveHGIOn
P Date
Poge
Chapten-4
9nput and Output opeHaHons
Junchama and
Standand nput and authut
h c lrbaeA ALL Aere lihcianie-
placed fem
C_LampPers
ane acceible by all
9nuHutputJuncions lot q
upeo nputOutbuf
hare been dehed n stand aYd
unctiong
LibHanie hese Can be clagsLdied as alloLIS
alous
11mscfe 9/0ehehiomg Jhege uncioms
u gfo Heceive 9nut
heeuncians c disk
e 90 uncliomg access
fie
hard
ano
beytomynbur
OHlobby disk lo
Outbut
an9cteJo Junchang A CmeBe Lammbge
IRe VDg And he Keybaa
he Cangale 9nbud and Outbut unchiomgsu
|be cLaxiied hh UD Categ.oHies
Dfgadvantogea
One di9advantage o
ScanL Ren fakîng
9nbut ig hat 9t P
SHTDO Rat h a been entexed 9gnote tn
ot}er a blonk
gbace Jhus, SCanldot ot tabe
mulhi- woxd
Stning nbulso 03aRe mueli wondmui-wod
he ghoal d Uge gfna
gey Meltod
Pagc.
mtahomb-Fon
Fon_Floahng baint Valuen Re
OHmat Speairey e olaF and 9t
SuiPe n i 6 decaalblacen a e e Jloatin
ah-on examble3 1UIPA be dislalayed a
-6acoo0.0 gnOHdeu lo Lmit fe_ clecma
lace ae laatiho pintthe oumat
sheciieH Can feuMÍtHen a loa3 on
3decimal blace atteJloating pan
ntonn.ated Congote 9o Junchons: 0Jhe nlonetled
Consofe únpun faulpl
chaMaale a 0.
unehmS deal uilk_g Sale. SAO h o ol
ChaHagtoH g_le ug
Looe
hese Untommatted uncthons
Syntax
Vafable Name = geBchel
Example:Chan He
HeC = getche ( ;
Syntay-
Vaiiale Name qetcha()
Here asiabte mame shaud d be yali d vasfa ble
ome nC,ComtoStming to the Vaniablenaming
Cmyenfef Lren uu execu he p o g i a u , tro
Examble
Cha Hec
Hec =9etchatU;
executfng above Slalemen!, HRe koypHeMc
m_ o the Vamiable Hc'
User LuiPe be amigned
u
J s asng e Characke
Hutchanl Putcha
autpu unchfan-9t qugt tHansmi
asmae chaMacteH_to Shandand_OutbuE
deurce memitah).Nhe unchom takap Be na¢
uanfabe a agument and olishlaya he
chaHacterganedin vatiable_m eOCen he
delnrHem c BS Huoctim is shHed h heade
Jite skdio h
Syntax
putc ba[vauioble nanne);
Exambie
chor CC7-
A
buch0Hlc);
Syntax
getelStHI0g Dame )
Syntax
puBlgBHngname
Foumat Sheciieo 90 Hene'S a LRat
liat oo
Cmmamly Used c
21 Cha o C
Q Loat foF
double o hd
sSho ant
IInsfaned gnt
Page
agnam to
9llugtuaBe PuBchan[) unetton
Phagam_to demamshiale he uge
9ncude <gtdio-h> Putchaul_
Manj
chay ch-
PainHnEnteH onun Sihg le
ch getchaU;- chaae ker">
pmnH (n on enteue
Duteho (ch]_ d Re chabac
hey -"
Phagmam în C_
odemongtt ake he
aetche ():,gels
9etsuts in_C Languageuse
9ncu deSldio- h
9nclude< canio-h>
Vaid man
Chaat ch IioJ
cluscH(U:
PtinH("Cnten youi name"
gels(ch)
Pufn n YOu name i s - ;
utslchi
aekcha(
Dote.
Page
ChapBen-5
CantyalStaBements
Cantual1
Skatement
Neale.d 14 LanA
LSLitch staterent
Dat
Pogt
pHacedune 9 Statem
Bnanching - Branehiing usa o 1
executing a block oSfatement
On tie
tfe basss o the tegutf ol Condi fOn
his s dme fiuough decis+on mokihg Siabnenj Canditian
Ohe Gen
pafic uta
etng
boîn n
execuhon
pHOgam-hig ds done
ntax
19 9tate ment
elgo Stalemeht
3 elge 91 9falerrent
4 Nented
5SLTtch slolCmepl-
Statement E 1 taletnehh 1e a Conditionot
O 9elction Con stnuct tfia oed
tc execute a 3et 3talemens, 9 Cetal
Condition t iue
OJhe Gaenetaf Syniax a 9falerneni 13 -
yntax
9 (can difion)
Statemenl 1;
Stalement2:
(Enty
Comdiho Ye9
EXecutg Stalene ni 8lack
No
Ex
uh
Examble Student
fe pags naie
a
o Check ufle iReA
Cxaminaton
Student
19 pas
Lubetfey a
PHagHam ta check
#include sstdro-h
Încludes canio-h>.
Yaid main
(
pt manRS exam
matkg in
Fain{" \n Entey yauH
Scan (" %d" Zmanke);
94(maxbez=35)
sich
else
IStatement block 2
Entny-
NloCmditim Yeg
exit
Flowchant Fan else logc
Examble PuogHanm
Wikea pHogHam lo 9nþuk a numbey Hom sex and
pHint uUfe tRe Re numbe s even on Odd.
9(numo2 --o)
pHin H\n You enteHed even mumlex");
elge
9Llughatian
houQai-
PaagHam 9npuk a mumbeH Gnd 9toxes 1
-able Num".94 Ae value o num S uM iex divi-
-STble by 2,the tinsk block aStaBementeuS
executed
executed, atfeHLUTSe tRe Secmdblock
pann enlerednoisd+visible y 9
aetch;
LLusta atanf-
dhepHagHam inbuBg a numbey Qnd SioHes I o-
Vamable mum', G e Mumbez ie Commblets d--
uierble by 2,0 mogcage is pHhted and
nested SBatemnent s checked-94 he umbethen_-
g also divis+ále by 3 anatfe
memage S
nnted
4 9else iy stafemem elge
cansinuct woH
a Situatiane utee fheHe
OHe tuo bossible exe cufiom palis osr aCoditt
9 paclica pHobIeMe, tHOHe
exist mulipleCxCutir
at Ho Camdihan dan Such Rlnd ol
pHoblem Ch0 S u phon
oY elãe
cOngrauet:JhisCamshiuck u0ukg ui lA
Condjtions having muliple osi& lo
Oukcome 9 else (mstouct ig uked
ReConcu fiom_han multible uhel
potl ble_autcen
Date
Page
Suntay-
91(tomclitkm 1)
StaBe ment block
elee tandition )
9taement block e
ee c omdition 3)
Stalement blocR
else Constuc4,cCopitenchece
LBree erecutiho
mep- to battam istcmdfia
ReConditiomg
Hye Ren gtate ment black wauld he_Oxecuted
bed-hat
Qnd Hes cmditim 9 LuiPP nat e chee
9sanAall Stepg HPe _tRe end luipe be
8RIÞpe
and ne otfea Cmdiiom une e chek: Q| camd
tion
i s jalse,tfen Cmly mcition e nte_checked. Q
Comcd1Hicm i e u u e en Stalepment black 2ufP
be eieculee and Hest all wi b skiphed
be
coditom 2 is ua Jalse,tAen_cnly
lcnd1ticn 3
uPe be checked and stakmonh}lockluitY be
execued 6elu Flauhast 4llustoates _he
Nmplementahfon ol Helse Cmstuc
ueCamdihion false
Shakeme ueomdiliamalge
False
Skakemeat
lndtiony
Stae men
ueandihonalSe
dylault
SBakemen IStakome
Next
LSmtemeni LLaw CHART OF 9F
ELSE Lagic
Paagam h demamsthate else i ComsktuctE
nclude <stdio-h
nclude <Cmia-hz
Vod main()
pn n Cnior yoD maks"):
GCo /%d", mkS);
Okes 35)
pin h 9 om 8oxHy!You ae FALL "
gelch ();
Outbut
Ente YoI maik 3: S8
You
You have ga1 B grade
5Suitch Cose anstiuctuten Re nimhe
chaiceate alondt
le lange, gumtch cage Camgiuuct ig uged
age Canstuckig a multiuay_decial0n_lmst.
ike else ilamstuet and eviamssth
Sameyuncthmafiky
yntax hqle exHealmm
Siteh [vaaiable) eauals-
\Caeo n s
fant
ade blachi
Case value 1;
Stalemont block
bHeak
Cane Value 2
staiement black eaual t
Caye Comgt
Code
bHeak Alack 2
'
Cane Value n
SHalement block n
eak (Cquala o Code
blacRa
alglaultz
deaul gfateent block
byeok
DeJaulleade
Re yaliable gn
n Su+tch Cabe (onstauct
suitch ha^ been applied o cu)
LuReh Hie
9nlegey oo Chabacbe vadfoute
bo a valicd
Dafe
Paq.
ncde<sldio-h>
t foc Lude <lanio-h >
Vatd maib (1
chaH ch =0-
ClugcH 9;-
Enlex chanacter }-
pHn
Scan(J%c"Kch);
Suwitch (ch)
Cane_la'
pxnH(lnketed chatacler Voweln");
bHeaR
Cage e a
yauel"
pHnH ("Entened chaxackery is
seak
Casei
pMhH("Enlened hatacte fe Volel ");
bweaR
Voue"
pHnH(" Cnkemed Chatacken us
bueaR
Cage ' :
lavel"
Datn Ckexed chatacles a
bMeaR
delauli ent
Enieied chakooen IsCnson
Pn
Dafe
Page-
geich
Lagbs
Entmy
Condnailed CxTt
Lntautled1
da uRile
FoH
LwTLe
9ntalTee
Conditm talge
Hue
Body o tRe
lotd
gncHement/
Jdecnement
Ext
tlo chant yoH uoMkhg_ ton lop
Paga
Suntax
9ntaLizahion expuess lan
uRite (Hegtexbuessim)
StaBements
udafe ex Hegein;
Elo diaguamlchat
uAite
Laçhsla
FaPee
anditian
|Hue
Execute la ufile
ap podu terop end
inl i-1;
Luhite (i<S)-
pain ("Hella uaild \n;
itt
Poye
gefch
theLaap
1Do ufile lachi-9n_do uhile laahs also the m
execution g iexmihated
he maindleence bef-
basig fegt canditian.
loab and White Laah s dh do
ueen da utite
Ae_Cmdihdan s togted at
Re end
hile loop
uhile loap us exIE Conaaled
Laabody je da
atfie tun laapg aNe eny Cmfoalad
UtieHeag Re
uhiee_loab e Loup body uitt exeouE_
laabg.9n do candihon-dauhie_
Heghechive q egt
atleasE cnce wikh body aloop
laobhg canshHue in
Laapis bogt iested tßen lonclitiom ig teated
Iig exaruted Jiush apd
Syntax
intializahan expHegsian-
do
lgtaBements
ubdate expieggiam_
ufile (tegt. expHe9sian };_ Sraa
Flow chant - On while
Laah
ExecuBe
Lacd padly
e9 talge
Comdir
dHueuhile loup)
ends
Dcte
Poge
Lxample
Ic
pHagtam la iteusliaBe do uhile
nclude <stdia-h> loap
include<Conio-hz
Vaid min(
Leup boady-
Painy"Hellowahld n"
getch;
QLlustHatiam
9n above þnogtam tes Condilicn (is1) evaluates
Ho alse- But shiee as JRe loo is exit Conbact
Re loop body uilt execuBe ance
odih
9nfnitelaab An 9ninite loop is a þiece o
that lackg a unchional exit So id
indenitelyuAn 9nffnite loap eccHs
SHebea evaluales lo 4siue
Cmditton always
Lufen_a
ually i g 13 0n ettoM
umping StaBement Date
Pone
Li Re uGe
eMS can be executian gdertain
use q
qLoap
StgHom-
Loap,
me but thte
the
-ence ue Hebegied
Canhaf don a mumbe
alten a
ceet pHog dam
the
ie te oxecufm
e andea înîn
andey ofiich eequ-
Qxecuted.9ngtalemens
Stapda1d ie wiich
pHogaam CUte
Re
pHagam gtauk woy,the
Aom the iustOXecufion q
CUe
body matn Stalencat in
e eenditicnal Hunchom gnd
6anch ffe Camstauc_ can be6eemtioues_dounwads
executiom om L1edto
Kanguage ofes a uay pantieular
baxtieular pat
path: C
C-
0executicm
gta lemepk Qhig iwT. gltexing the Sequen
the hèlp ot
umpina
ybe umbing 9tatements
Qoto gBalemeot
2 6ucak gBatement
Cantinue gtokement
BHeak gtatepgent -ahe BHeak
gtat@ment is
9edlo
Hhe Jeumihahiom tfe loos OHminate
Can
the loahs
uaug bammalfesmfnghom and OcaLuih tua
tion he namal lkmmaticm abnoapmal
Lacp
lemfno
4he lmdifen_ phase occLuas uhe
the Loup Heaulh in Jalse
gn Come cae we need lo hHeak_he execufio
of keopHeadehendino m he Value 9nbut
hu Ugey hig called abnamal tesmfiq-
Hn-eLcop-bueak StaBemenl aig u9ed uh
Date
Page-
Stalement Stakement
the boieak
uch Caep. ufenevetCame fo
naf9taBemen
iust 9takemenj
Comtood
used,Hhe
Yhe Use
Shaem
o bMeaR em
e r L a a p body- 2unnecrsa1y enetuton
ednces Ae numbeH o Jhopacgda
_uway, 1} beedn up
Laop bis decoian makïng
SkatemEnt
x e c u t i m . 9 E fa uGed wiR
execufon oj tuather
iecalton
aaes tRe loap h SBop
Synhax
bHeak
Flau_chawt
Lop hady
Shauta
Bueak
Canditim-
to6HeaR
Falge
PHoqHam
Vaid main(L
nt i-0
Date
Page-
clgc(
(-5)
bHeak
pxinyad",VI);
lgetch(;-
gpecitièpHogHamm
21Canhhue StaBement-9n Some o 9RIp
hg bHablems,we meed
gelemenk tRe loa body and
fake
me Hemain ng
Re Cante to the begihnihq o Be loa Sn_
9uSEe-
Siuatiom_ ike RiS Cmtin ue gtalemenB
Cmtinue ghaement ig_uged to execule otBe
skiphfng gomeÞartk decdaaco
baHk lorp urkrte
kemnmating_lonp 9tt-
de_candihon, Hatier Aan
nexf eaahicm oSame_
LCambinue lo execue Re
makmg 9talenCd
Loce. 9 e used witR_decteian stalened
uohfch must be pxH@seak_hside laofJhis
Can be Uged 9n^icdo o uRLte ox_dlo tRele lor
Suntax
Cantihue,-
Examblef-
IPaogeamo brint umbeH om to1a and sRIppng
am tolo Sequence-
ndudegt dio-h>
nclude s(anio- h2
Vard maïnl Chalement. ufeneez e Ue gato stalement uiR.
Label,fe Comtoat qumpS 6ackunaid aa cawad
and execuea Stakemen Cnu
to 9eaHch tfe Label
cscl)- -Ards
ai;14-la;itt)
9(i==5)
Suntax
Continue lgoto la beL
arny("I%d"); tatemenh
Skolemen
gelchll label:stalement
gBalement
Fale Camdhon
Cmdi-
9 Camodtfm
him3 Hue
Fabe Stalenent|
C_
Fabe Stalement A
selement Stalement
B
Sialeren
ChapteM-6
se dened unctam9
LMan PuagHam
91 e ounctand
Funchfams Can be bHaadll_calegoHized into
tuo Cate qonie
9nbuitt oy Sustem dulied au libHaHY Juneioy
lae delmed Yunctiam8
99nbut Junchomsf hexe_aueRe- uncf utake
clelition s aleeady delned and
stoned_h uespectie headen itea o 6Haxu
ahone
Jhase unchcan.g can be eaity ncaapasaled infa
puagamg by- ncludhg Re eahectie heade
iteAnambley d Ris ybe o uncto axe
ges puBe(1 clua.rll,geichlg, þaînt),scanjC)ek
2Hsey_delhed unchnheJunchng LoRch
CHeated by e Useto
enjoHm Ré desiHed task asHe Called Ugex dy-l
med un chons dy
Adiyantages oeex delned unchong &-
No Redundanty/Rebiiotop B- Comp lex þroguans gent
Hally Contajnsame piet
oCode at moie IRan one Joa hom fha bta qcu
wien ue oreale a unclion oHebealed Chde, f e
tHedundancy oCod
boQMam l e us fsHeduceol,aze
Meduced oeetne
nd 9tbe come h
fo deion
and dibug-
Date
Page
PHaguam
lcheck Hom_tun numhen tRat wffch ls bgay
#hdude <gtdio-h>
#hdude <lonia-h>
Vaid qu@amuml);
h t man (
gieatnumlly
Hehun e
Vaid gieahuml
nti,d
DafnHCnter 2 numseas Rot youl twany to cOnbane.
Sean"hd %d ,ki,&]\;
pxin he gheates Mumbes ig : %dil:
Date
Page
ele
PHNHJhe gueaier numben fa a.d
PHaganm
nclude<Sldfo-hz
ndude e (ooa:he
Migeamuml;
nman0
Heult
gaeotnum ;
=
De
a1qumentg and
no Hehiun
n.ch m_uiß
S m e a l u e Om_R
unchon_o thfs ybe take Vae Ha
he a n d d o n t _ H e k u a n _ a n y
CalngJunchm
Caluhq Junchom
dhe Values
Valuea
uom
Called lunchom R e u n e hom Cal_OHe
UBchaNe_baDged
wR
ba&am@kas dg umeNB-
Lalled a s _
Puogam=
hluLde <9tdahz,
Ehclude< lonio-
lad greatnu nka,int 6),
ni mainl
JHetuan X
elae
HetunU7
a l l by Vahe helRad
PCallby _ejerence mehdd
agam
#mdude<stdia-h
meluLde< Camia h
Naid mam(l
h Sum[$E N*)
nt a,b, an S;
prin( " Cnlen 2 numbes"),:
Scanj (od ad",a,&6)
ans Sum (8a,k6);
prin n he nesult allea addihion is od ans)
geich(1
fnt sum tJ, hi*)
veSLuf,
Ie lun( nESut
Pe
int n-
pHInHEpleh numben uthoje ac otial yu uant n caleulaie :
ScanSad "&n;-
Facn);-
pHinachhiak=%d
ín dact (intn)
eluHD O-
else in--l)
HChun
Clge
bte
Pege-
Helwin nxjactln-1)-
dvantage
Recungon_makeA e bHogHam Cade Camhoc
toH Same Cambicated pHablems Hecunsian an
ead to Scduhians Ra aHe much cleaHCH
easie o wHte andmody
ARecuHsian fs ve Simbleand Suitable h he used
datq stalctuHea like StackS,aueNes tHeeACtr.
nCase oHecutaian Sushem takes CaHe anien
StacR.
5 Recuisian is UselueaH tfebHablem fnufh tfee_
fs Same Heheifian.
iniha Hon
RecuHsion fe slou in feimS ospeed and execuia
time
Recunsim_ takes mnoHe mernoMY apa.ce as Vatiables
13Lacaf Vaniableg B- VaHiablen JRat aHO declanedinside
a unclion
aHbloce aHe Called Lacal
VaHTableN Jhes Can be Used anly bystalemente
IRat a e nsïde fatunchanan black q code-Lacal
Vaniable_ane nat Rnaun to unchans_autside
chRei0un- he dollouing Cxample shaug_hau
Lacal yaH*ables aHeUsed- AL Re yaniablesa,6,cc
ane lacat tomainl)Junchon
Examble-
nclude <stdio-h>
hncdude 4Canio-h~
aid main ( 4
int a,bj-
C tb
prinH"Nalue q a=bd b-%d_andC ed \na,a,c
H Globa Vaiables -Glabae valiables_aHe detihed auiside
unchon, usualls an top o the
bHaqHam- Grlehof Vatiable hald Aein Values tRuoughalul
tRe litetime o y a ptogHam and ifiey Can he
accessed inside any efReJunctions deined JaY
Re pHagxam A glabat vaH*able_can beaccesaed-
io auaiP-
by anuonc hon. hat is, a_globat vaigble
able ya Use JAhoughout you enhhe Hogam.ajey
Tts declaxation
Example
includecstdig-b
Endnde<Conio-
Dute
Page
int
Moid main [)
Int a,b
a lo
int a
choyb
laat c
pio"oduc aa,b,e
Stafe he Vaniablesdelined glalic Gpecier can
a
hotd thei Value belw een tfe mulfiple Juncion
Call-Stalic locat VaHiables de Vigible anly do the
uncian OH Re black uRich hey axe deined
Same Sratie VaHigble Counbe declaned
asigned
gnly_Ome_
at
integeal vaHa
im
bla
be VaHfa ble
many tmes buk c a n t a l i c *ntegeal
stalic
e Shatc g
S
A e Sate
Lglaue Înttal ualueghe of ieibltiky
isibll+ky r
atfiexuise
null b wßic b 9 A
bwßih
sstatic
Suntaxb
be_name
vaHia
Stahc data_ ybe
Examble
Hincude <gtdio-hz
+incude < Canio-hz
Static_chaN C;
Stafc int i -
Stahc dLoat .
Static chan sIial;
Void main(
pHinH"/adlad °lo la9 IUF-
pinad",a);-
Example
Hndude agBdio-h>_
int a
Int mainl
exlen ink a
yntaxb=
extenn datq_tupe vanable hame
anple-#indude <Stdia.ha
ndude <Camio-hz
Exhetn nt gl=0
Vid mam
Void l:-
pHinHnhevalue isocl"qL}
pnn the Velue d oollencalulhgtal) is°dg
qelch)-
Chabteu-
AHHay
not ham -
ntauze an atay
can
Q u s f-We OH UG.
a t izing ne by
One
C eitfe
staBements as ollowe
a Single
[loco-0,2-0,3-4,7:0 0 . 0
deuble balance I'51 -
beweenbHaces_Cannat_bg
S10 to|So
Dute
Pory
nt a[situl
nput
H(iz0;14 5itt)
ang=0gA414t)
pHinH" \A nter HRe elemen'"
Scanhd"&a[Il{I1
pain"n"
punH["\n You enteHed \nz_lathu
oiaiL5;itt)
pnH"\n"
getch
matHix
ta add tuo maluk inlo RiHd
HagHam
include <sBdio-hz
ncdude Conia-hz
Void man ()
1,2,3,
,2,3,4
194,3,
int aH fujtui=
44,3,4
4,2,3,4
42,3,4}*
nt oH3[uj[ui
hput
oi=o;ik4,itt)
onl=03L4;jtt)
Hati1ll-anTEan2[i1[
phinHnhe ax.
aee addhion is \n
Ilutput
en(i:0, ia4, itt)
Eonlga0747
painHhd',at3CiJL4l;
pHin n
getch
int ants1,1;
l0t max (imHembaul1,blGit)
element in avay
piiny"\n Inpul
aH 0, i45;itt)
gelch);
întmaxint tempauI, ihi Sie)
is0,isSizeitt)
tempau1iizm)
m stembari[i
Helnlm)
vasthtarA
ite declaning StHngSÍLe us
Can uwHile JAe above not mandatoy Sa lu-
Cade aA
Stang litexal B
Chacht-41aveushamma
Chanchli-\'44ay%,sha" a\e
Shming Examble in C
Endude ssBdio-h>
Eincude Cmia-hz
Enclude Staing.h
Ínt main
chan chal1-"to va lpesinl
Chan Antay Value u %s \n ch
pai
pHin(slming Litenal value u b9nCha ),
Metum 0
chansI3a7
pMnHEnley Re giamg "):
geu(s
pnnt|"yauw enkeaedJsYs
Declanatiom-
int þuhlchan[1)
xamble
Fhdude<stdlio-h>
Ehdude <SLang:h>
ME man)
Chad hame [Sa1,
pan Ente youd hame:"J
geyinae
pn("Yaua hame Li :"
puk{hane:
ALkum o
- 9 n additm to inh
atng Mlan>pufakiam Junchens CInd utpul unction
untiomg
gthihq_manipulatiom
a E o has many
DescHipfion
Ne Funchian nar
Retuwns tfe longIR qf5Toirg
stulen[aiming-name. tRe Can enls ooWie sti
schy(desihahmCopies
to destination stng
Sautce)
31SHcat(tinst Conca o job inetgting us
Seamd3tHng)secmd g oing be utesult t
gmng is SBored m Lals
HJ1Stacmp[iHst gtmbg, lambanes he jiHst_9mng Juik
secmd-9thimg Secmd emhg. 9bath Staings.ag
Same i Hehiàng 0
Hehuun9_HeUeH9E 9oin.o
51Stmev(atHing
6StHlun(smn He huans smg chakacles i louex
19ubHLaung Hetung going chaa0g EM hukaa
include <stang-hz
Vand mah)1
cha stulea1:
pin[ Enten Stuing:")_
aets(stH;}|neadh Staing JAm mAode
phn("\n lower stufhq js J69"9iulwnlsba))