0% found this document useful (0 votes)
50 views

c Language Notes

Uploaded by

beastboy21718
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views

c Language Notes

Uploaded by

beastboy21718
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 136

Date

Page

HagHammiog languagea Puagiamming Lang uages-


He

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

High Level Law leuel


Lanoiaee language S

PHocedu abjecton Assemb| Mac


Haf ian iented Lulan= -hine
Quage language quage langliaqs

Machfne language la,loll


1 DiHeaBly MUn on
CPU
iiSenies 6itiko, O and 1 O1Locol
iTediau19 and eHHOH_ þHOne to wnite Cadle monuia
Ivnotbayiablo Mot human unclenstadable,-
HAseemblu langugge
1Hlese ewiabOne
Date.
Page.

2 Coding eaaien dñan machine language


3 Reblace and os wilA Engligh ineiHuction9
LMnemanic Cades ou COMHOSbonding mochpe
language IMav94n
S Dienence betucen pHaceduiaP_and objeatoi
-ented language
PHaceduiaP Languuage- absect OHiented langulage
HPHaqnam iG uHtten ng PHagham ie an *oBetachan
sequence o9ngtnuctiong lo unc iang betueen ekiece
25 PHaeduyat bHogHanming abject aHe nted Languageg
allaws tep dounabpiaach olloug boitam uh_abhHoach G
9 t docg nat haue huaheH t belps in LuHapping daa
uayda hiding data and unctians n a clagg

499n pHocedunaf fanguage9t helps în buitding gecL-


data iS not gecHe He pHOg
HamG

S9nbHOcedunot Panguagen object otiented language


Cade S Snteudebendent |code 3 maduPan
9 n pnoced UHaE Panguage | 9E Can 6e extended
Reuse i dileuft

Nmeman+cs meang 9n9tnu etion'eaiven and


Canueted unnbinaHuaAm cailed mnemanag_
afe
Page

1 aceduiat tanguage 9n bruoceduiaP anguage


Piogiam u9 uUHitten as Seg,
uenge a netuctio ns

Exampl+
Stad
9Luake ub
bueh y eeth
9 apen Hidge
take mitR.
waum It in m+cHawave.

Gbject OHiented language In abiect aHiented lan-


g Llage Pyogaiam ue an.
Noteaction o unctiong batuween abie cks

stah(
obiect ME, abject nidgd
wlakeu) aben(
bugh clogeC)
abject Wau
WaimC)
Baket

DiJeen.ce behueen High lovel anguoge and ou


level Language
Dafe
Page

Lau leuel language


Hloh level language 9t i9 amachin@iendlu
gE i9 pHagammey iie-
-hdly language Lanqulage

2High leuel _language is |lau leueP fonquage fo


legg memaHs_ejicient high memanu1cient

319 is CoSy ta undeugtand 9ti9 taugh to undeistam

i sis eimble to debug i9 camplex ta debug Co


hauatiu@ly
59ie simble h maîntain t ig Camplex ta maha in
CambaHatively-
91 is þontable Nan poHtable

3 t Con unon any 9 tTs machthe deben


plotom -dent

a Hah Level language'g| law level Languageg aie


aHe ea9y to Leain and challengihg fo leana and
lIndengtand LIndets tand

q hey aHe execllked.olo-hey exectte witfi high


-LueN tHan low level 9heed
languagee kcmue they
Meminea tuan9lato1 bo

9 19 wHItHen
n englrehat 1S witlenn Re Jan
Aabeza
Re Callec
d
generaion ano
uige
hene aHe
Date
Page

lohey allaw much maie hey allaw Littlo on nao


abgtiackion abgBuoctian

I|hey do nat buovide ma Jhey ae ueHY Close to


ny acifrties at tie ha-|haduaie and helb to
duaHe Level. Lusilke aþHoguam at Re
handuuaHe level
19 9n HLL Jan uMTthg bOgn l jon mlHhg bHagHame
Hamg, handwaMe Knauiled handuwane knoLuledge
ge 3not Hequiued mugt
19Hhe bHOgamg are eagyModiumg bagHame1
to mody dijiaukt
141A Single Statementmayhe Stalemenks can be dited-
excoLHe Seuenaf 9nsBhuc-ls mapbed to brncesso
Hiong- Qngtuuctiens-.
L5Examble'e:Penl, PagcafCxamble'a: machîne langua-
Cogol Ruby ele ge and Hggembly languagE
E is le the am9umibq t g tme
CcomgLumig-
8CambtReH 9t 9 a
buanglaton ufich takea 9nbut
ie htgb leuel language_and pHoduces.an
autput olou level language ie machine aHa9semb
-Ly Langu.age
cOTmileH dg moHe 9nkelligent tRan an aggemble
t checkS all kînde o Lînitg,Hange s,eMOHe.ek-
But Stg DHOgHam HuUn time is moHe and occlupiee q
LaHgeH DaH o memoH- 9 hag 9low Gpeedbea-
Dafe
Pue

-aue a ompiteN gaeg th>1aughentije pH0Q.


he
e Ham. LL9E con
and then_hianslales the entibie pyog>1amunlo Code
machine Coden

IGawice object
Puagiam. Cambilel bag2iam S t doe

e9nteabueBey An Iniebyelon Je a HOgam tRat Cxe eutE


tHanglaBeg a bHagnammng language
unto aCambHehensible Language
t tHanslales mlyane gtqtemento tRe þHOgHam Eg- c
ata lime
ntepHelexg, maHe atten t6ab nat aie gmle Ron
CompiteHS la Wanpi
SoHce 9nfemediate_
PHogHam Code
9ntepHete CampkiE
gD1euence between Combiter_and 9ntenbHetoy Souneep
Code
Cambite Jntenbueien i nte-b
1Cambite Seang Jfe wfiofe uanglales
þagHam-
bHogHam dn ane go-A9,91 one Statemcnt
Scans dRe code n ane galamsidextng JA ata fime
Scang
SOwHCE
Re enHOHS AMe ghotun at |Code ane lihe
at1me
Cade
fRe end togethe HHOMS aHe ghOun lne
by he. Assembl
2Man odyantage aeambiPet| Due o 9nterb Me
SstS executin_tme 6eng 9 low h executha kg Code
4Re objed Code- 9A emble
he
Objee
Date
Page

9Ecanuexle dhe 90LIe91 Hequieo) doeg not


Code inta objeat Code_canuert g0ICeCode na
object code Inglead 91
9cang ut Lihe by Linee
5-9_doeg mot Heguiue gou t JHequiHeS SOIC
HCe Cadeo Latey 0ode on laBey executian
Exe@utin

kg Ctt, c#etc Eg PtRan, Ruby Pel


dava
SNoBaLMatlab efe

lo oxping g Cambilen and gnto1hs1e ten


iCOmbiPen
SoucePehuaceabject
Cade geing LCade
|Puacegsiny
Machtnel
19nteabaelen
Sonce [EcpuncacainntenmedialeBiacegsng9nhezpxeke
Cade Code 9nheabneked.
Assemble- 9 uged to tnanslate
umitten nsgembly dfiebHogHam
Code he 9auico po language inlo machine
emble diat Contafhe gHamife anan uhbut
uhput ooan
anass-
as9-
he a9sembly
She outut geneHaBed bu tfe Lang uage Insfouctio
Object ode a machns assemblenue the
he
Codaunde1gtandabtoby
nLmang
Gnteace ufat fs abl uto Cmmunake
anasschioley a
l i n uAe maehine i g need
Pe he aap hcHusen human ahd machihe
utRat feu ca Camminicate uER Aab atey
Code usiiien i n assPmblu aruae uS_SmE
SaHt_ a nenmanicsinsuchcns ke ADP DUL
Mux GuB, DIV May a So cn and aesemble-a
basicall ahle fo Cm.et trase mnenanic S uN
Bnaucoce. Heie ifeae mnemanias a o depbend
uban Re achitecte o he machn-

9 Lanquage puOceasom'9 Campite-a 9nhe-bmeieis,faan|


Slaie pHcgHan9 tuilten fo
high leLel languages une machie cade that q
Compuie undeStanda and asSemtleve tianslab
pHagHame wHILken ih lou levelen a£sSmbly_
Longuage dnta Gac)machin e eedeIn cmbi-
fatmbHocCSStReye aHe sevea gtages - e beip
pMOgnamme19 LwHiBe eeo e e Code,tacls_ae
OvaiPable

8uRu do lue need pHegmammYng


cAng Pdanammfng e meeded t cueais Vauia
hheg cabbl+catan andYsiem Sqltiuaie-Suete
SaltuaHO aMe geneialy Ceak@ bs Syshem p
aammeHS2pblcari Sauae de Ceed
Date

AngPuaguanning_abbiaachsa ane Jtie Metida hal


aesed to delelap a Seltwaie sotulio n o a po
blem.PHocedunae and abject oyjented bfago m
-ming abhbjaachee aHe generally uSed o po
Hamming obiect 0lented p)1agaamming app|oa
chua eLN and mone etticICnt a poIOadh of Bio
-guommina ag Ccmbored lo þrocedural pangaammg

SuAat s dhe meed q_1ebHesentng proga cam logic2


Ang Bedana we gtauE buiPdingdne ofutton a a
byablems.4 fe cucated ànd analyred on papo
Lutfiite analuzing9 he Solution_q/ a baoblems 9t
Hebegented I A Ae helb of Logic stucbiesenlaho
tocta Like lou cha-ts, algiifAm9 oto: 9tisve
Imboanht to 4ndezstand He logfc bejasc slasti
ctp actual develabment Sqhuae

16-BocediutaP bHogHamminqPHOnedubal togaam min


Cmoisls QwuiHing a
Pfa o gnebuchong Lt6at ure onqaihzed iogHouAG
called ncton9- ane on moNe Juhc tions ue
CHCaled to ac compli) one oH mao taskg. .
An bno ceduat pangammng tob down appM=
cach ua otloued la bHeak a lange pnnodan
Shto amallee uncen9-
SlueluxC Qpaogaam h aococlus oe paogaamraln
Mgin byagua m
LFunchon| LFupaliamA EungtiaAsl
Lfunchon LEnelinl
Date
Page.

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

9dvantage 'a oltocedtuaal bàagaamming

PHagHomming feam gtaus ocuSed


am the goqE
4
ueuane knaug his be1Hob
ma91
33B fRe ime Re þàagaammniho tarka ineio Ae
stiong
LuHilHon|
4Cado S Casio utaallougimo 9
me Radically and uilR þurbago

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

1bied Onented paoGAamming g-object ouenied


pAOgHOamminou@
desioncd o Henmavenelaue 0aocèdund
Date
Page

DHagaammhg-abiec on+enhed_bMOgAammng mada


bHeaks dato as a cuitical elemen' h buagaam
and does mot allmu ut h moie queolu around
Lie Suaiem:daka e tied moke alngel+- u n
-Chong daa ia bHaiecled uamm accidental modli
icaimt atAerdunchiny 0lettomepteo
baaghaMming Cohihes dalo and Junchonsactno
n tRa daka dnto gmgle nhy Colled aajee
9t allows acceung qdata_cmly thuOLLgh a
Set cHunchang 9n abectamepied the Cmphaso
ug gren lo alata taRen UAan ach_a tunC
Hms Hero tRL þanqdamg One doled iht
Oleck and daa StHucare ArO Caeaiad n_ manhe
Rat ey ahak aclenze oGjeck-

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

.Wi8LAmablem Anafuaig9n tRebuablem analyalsha


-9e 6e gntenDaE Logic ol h
Hagam ug labned Ghe anaPieie þhase t
geneyaly bertoHMed b buognam anaPuSkg.
VaHiALIS þHogua Anaiusis fehn iueA Ol ug
ta uepeNEnt_Re_Jagie q1b1ogàam-_lou cha4
seudoc adeA alguniBm9AHO maihly LIAed toais

1 Codingter develobing Re deglHed Loge


ond eeouence gleb9 sla olevelob a_
bngnm iie deuelop1s each atRe ca
ce ng Qlage. 9n_Coding Sa qe q pogaamm
lorguage Like c_ond t i s selededo d
aogtorm 9nBiUohÕnS ate _Loded a9 bozAe
Sunio y ochoeh Language

3Debug9mg yioy Codihg desuedlegfo


ufepogaam u8 done i Hie selec
-led puogM aomihglanguage,une þragam 19
checked doH OW Rinda QfSunlax Qnd 9Aommah
-Callu mislakeg LIlre engligh au hindi, Combu
ebHogaamsha languog2'a l o hove 9unan
And ad amm@a1 nepaoCOAS mo
a endo a euIIrGsJOpàogaam us call@d
clebugg hg-
stngAeS
aLesemaug 0 eou9 HOmthe
Hogyam- A xeculeO Ourd
Date
Page.

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

195HLgoHIMm AlgoniAm s a 9eguece q Yngt-


uchions, wHHen unSimple enolèh
Language o Sotue ahartouta baolblem hee
paoe
can b maMe tHon.anealgonilras o Sotve a peatulas ptngaonmin
he 9nstHuctions wHftkenó an atgoiT HAn mush
haveatloutngchaiacienLeice
YEach 9ngtHucton 9houPd be ÞHeaise ad umabiguau
Cach 9nsaucliim should be titten un Such
mannen hat_9F Can beberanmcd mhe linei
39me on Mor@ 9nslyuchöm Shalld al: be_Hebeat
Cd 9nniiely dñat meang on mugt enguMe
t h a Re bMogam Stopa ajeA a given mumbO
o ealiong
49le erecuhno he 9lebg of algaritRmn, olesied
He9uli_ mugt be obtaîned
5Cachþaocedue ghould shecidu JRe 9npuls.and
0utbus available
G vanables 9houl d be bHa]ely defhed
s e 9ubb1Ogdamg On Subuouhnea Jheh@Mes

8DoCumenialn Shguld be ReCbut 9hon/


Ond meanigu
Date
Pag

21xamble'e Algoritfns and


Exa
EXampleAlUHike an afgoitimtn 9nhit manksSudenl in.3.9ub paîn
Schutfn
Steb 18 9nltiatige Mi Me, Ma and Sum a lexo
Steb29nbut tRe matRg o R Hee_gubieats inh
MMe,and M9 Hegbechiely -
Skeb.3Add MLMA and Ma and goHe he Heg.
uPt unta Suml9UM= M +Me+ Ma
-uPt

Gep 4 PRINI SUM


Sie 5 Stab _

xamble WHie artgaim ta e0unt numbers males


Sadutan Sleh 9nihafiee GENDER CauNTMALP TA ZEHa
Sheb 9nbut dhRe gende o HGt bexaan
te. checR_Caunt to gee i t ie less JRan

teb chedk tfie genden fo gee ,9 9t e eouoP


o Mafe, 9 mof go to gBeb 6
Steb 5_Add L to Maole
Steb Add to Counf
Steb Repeat CounE= 1po0
Sheb 8 PH*nt maPe
Steb Stob
ee Flowchat
Floocha ustAe þïctomiaP_OM
aHabhicaP HebH£genta n o Re gleb ht
e Mocedue_dapHoblem o e gofe
/HepHenenhnthe loqiedlau o ae
bsog&am
Date
Page

2 lawchat Sumbelg
exmînat an avak Sumbol

Ovat aH Jeminat 9umbat


he
he eHminaP 3umbaf s LIed to ndlcate tRe
beginnfng [etaut, ending IstopJ- he g t
and lag aumáolun Flowcbatl19 geneally
a eHmlnat ymbat- 91 J9 un Shabeq a n oual

a49nput_an Qutput sumbof


gnbut and outþut
Symboe
he gnbutlautbut Js uSed fodenate anydun-
chHom o an 9nut_an_outhut deuce in tAe
bMag ao 91 3used uien an unþul is tgken
H a m euse Oulbut is displayed to use
9Hg ghabe iRe a (ecBangle layalelognan
3PaocegaingSymbo
Pa alelo guam
Symbo
PHaceeging 9mbot J uged inlowchaut
o HebMe 9ent ai Rmetid and dala movemcnt
ungluehons-9 feuged Jlow hatl, whOHCVey
weace adeliTon, 9ubtoaehan, mulhblicatiom efe
ug eheg9enled Su Hebagsallelogdom lan chan=
Reetangle
CO

P-

FEFR
Pae

onnec la Qumbaf ie uged to exlend a ves


Longlau chat an Ymext bage wñen a l o u
Chai &@cames ve4 lang low mo9 9fatf
CHOgein9 each aIhen_Qnd undorgland ab itity
a l o u Chatt Ieduce l a exBend dRe Lo
Chartfo he mext bage we use com neclon ym-
balg Mebuesenfed 6y a cihicle wilR an adtous

24CHeate a Jlou_chant to 9nbut maiks o stud-


nt an thnCe Subjecis and buht fie totat manR9

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

LuMting Cambuten nagacm al any levd o complexit

Sequence logicLPgeudaccde use» all logic olucture


2Selectian lagic iesequee gelection and Jtetatioy
3N9Henatiom lagic ts expveM JRe sequerre ol execu tiam
a fRebtiogtam
Sequen ceSeQuence lagic 9 uged on Exptea9ing
ctieSequeme a exeeulian o Inghructians
21Seletian t- Selection logic ig used do maRE
decisians n dhe pHagàam
3teatfm i s used to Hepeat the execution
et gnstuchioms again 9t q
pontfe uPan Comditian likd
Ex:2 unile peudo Cade o cauntmad numbe a adulis
and chidnen out o vo beapleaafouwn
Salution- Pgeudocode
SetCount AbUu CHILD Ta Zeto
ba uwHUE CoUN 9 mot euo to
1,aoo
Read te age ot er9 on
9 GE 2 =18 JLEAJ
Add to Adutt
EL9E
Add lo chitd
CNOIF
Add taCounT
END DO
RITEADULT CH1tp
SIOP
Date
Page

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

Muat be defined uith_canmbnalim.atCcmditioma


311Paatg deoisfm dable
able heading Denis*an Rule
Kanditian stu CmditicmCabie
Actian studL Actim.Cntiea
he inst pant Cantaina tRe name oH mumben
fRe dec*sian fable- h e 9ecomd þatt cetmes
eRe decision ukes Jo a giuen_bHablem Jhe
decision o achong debend9 ubon tfeee Hutes:
h e fiid pott also called ag cnditicm Sfu6.
denes al the þossike cmdHong tfat could
exigt dn the pHogHam: She aulA_ bat Rhoun
as Conditian enties Comtaiha 6e Comoltions
ufgi-
Lled JAe Rpat clep*cks sthe acicms_wAfeh
wiP be benjoMmed by Compute þrogdam and e
9ixA b ot Camkaio9 achon ent+ties LuAdh
hos do be talken uuien a geloaomdiffoms actim
ue ane
kxqmbleCueate a decigion table to count Re no
opuPation 1pro- Peaple who ate oldexgadullsaLd
fon 60
eaugShaula Mot be comSTdlered

Decisimtable noi|RLL|RLA|AL3 RL 4 RLSRLG


Kandihan gtalemenle
ge -8 Y
Age< I8
Agez6o N
Caunt~loun N
Achims taRon
Date
Page.

Addta CaunT|
Add nADuT
WHite Outbui
Read mext HeCO Hd!
uHite AAULT
SIaP

39 dvantageg Decis+an Jableg


1As ue have 9een _ufiat tie decis*om tobleg
aHe easier uto duauw and modu Ran loucha
19hes pnovicle shout and Ccmboot documeniatim
A dec+aim table le a puoslem having 3bage
Jul qlauchant may 6e aust y-G Lhea loma
3194 s coser tto analyze dae Step9 dufich udbuld
befotlaued uuden a eet oConctomg is dHue
tRon a la chant

381 Dis.advantageg aDecTelim jableo f-


takea mou tine do undegfand Re broble
tRough daision table RanaJlow chaHt
p G i9 unablG_to_demontuate he 8equend
executiom o tebgQ9 Shon by Jlowchaus
Date
Pog

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 !

as desigmer and wHte q ClanguageC succe


-uly CammbnesJRe gtHuctue o HLL and Re.
bawe and eciency o aggemb ly Language cy
louu jeuel language-

2Featuneg c C Language-

Chag a uelatiuely eageH Suntax tRan FORTRAN


COBal and PA9CAI
21C g an eiciem on.d Jast sHagAam mng lang uage
9 S moHe fan 5o imes asie u a n BAg1c
3C Language omtans vast get a daBa iybes a s
Compayed tolanguageg a i t s tme9
uged
C language ha9 32 mogtCOmmormly u°d
eywoHds 4nadditiom, 8 Keywonda aYe
Utt 9yeiempHOgammino
SClonguage is a higls porabts longuaa
h i s mmedns,iH you have CHCake ol acbro
9Ham0n 0Tne Compluley. 9 witt u n cn hie
atherCombuteNS witflouk ony modicatio9 he
ony excebhion may be a vEy cdifterrent tybe
oaeating Sugtem tnanol ue cempa
unwfiuh pMaqam o
1bleuuiR otalu CS
beencHEated
C is a_ueiy well guiteddanguage o
Sthuchued biag 3ammng J h e ptog Hammeg
Can eaity diike a_puaúem Jho Qmum6e
a modules ayJunchams-
Cbas got a-Hich Sel KTbanydun chore
Ghee aHe uieunchioms "Rat pHaide
Heady-
madauncHonclity to UseAg
8 alse has a supbant Jon 9aaphïca
9 ig an exhendible language-his paagaamuiü
meang
ugeHsanadd heiy um uc iio nS uo_ARA
Libmany Set.
loauiausensips_aC langtLO 9e ane avaitab-
-le am uanfaug Companfea
luibe Cand ANSI C libe BoHland
can el!cienilu deal uith 6il, bute and
addmeSseg ward
9 PHagHammingJechniques

HoguammIng un C JsNeHYNOHY Simit sa to


to
leauning a languageLike gImil+on
-ligh:we Can uncdeugtand h>n
bin di
di on tng-
be law gayeg ie
tapic by
eonina engligp
Alphabets Wonds
Sentences =7
Panagnabhs
agaphes
learning paogaarmmng
Date
Page

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 -

Cage gengitive language uhicb mea)


cap1tal (A Z)us di fesen¥ on (a -7)
charactey Set Subbouks_oloils om
e DigitsC t o 9- y Combnaton cigits
HOm AiSJOna e valiol un C
Date
Page

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

auta bueak Case cha CanstCaninue


delaultdo clauble else enum exBeyn-
FLoaB Fay Foy goto 9nt
lang nea HegigBen uetun 9hont 9ianed
static Stnuc Suitch ybedeunim unsigned|
Void wAte
C hass 3 geneaf buipageand 8 9peci-
-at bunpage Keywads:
5 Kules Fo declaning 9denhieng
h e H9t chatacleH oan gdeniiiOX MusB be ar
alphabet On un.denecoHe
ej|9E Can have letteH9, doiks and valid spec+ae
chanackeng
91C uiee take anly iHgt
8 1 chaacBeus qf tAe
9dentOH
4gdentijfeH Cannat be a Keyuond
5Yau Cannot Use a ufite gpa ce un Re Jdenhheq

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

NumeHic Camgtonte Shese aue tfe


digilsHm0o OHeaumed by CamsBans fR
9 cambinaticon g
have a fey may
decmat bant în_tRem aH May NOt
1 9nlegey
lmgianj9ntegen Congtanks
ncbHagu Sequece dig+te tAat aHe_Jae
am9: Decinal
and heradecfm ane useed
_onuumenic
al
IntegeHS9ntegeNOckae_
aHe dne
dfie 9nlege,s
-

Cmdan ij0clal Inkegen


Gists c Comina SntegeH tAHee
Auee
Cmgiank type
ybe
Com
hee anC paece dedHoms Q Cugit Homa Cnsiank Cm
on Examp le by lea dung 0 to
fi exadecmal 025,05êys on_ O
b Intege COmatanbs
Constanhs aHe
by Cmahations o digits uom
ae
diep>Hegenad
eHesena
0la 9
bate
Pay

-Hactex G Juan ts F an alomC - 0 to 15


fgut rom lo to 15 aoe Hepr eented by chaaacery
A especHvel
Ruleg Fon Con 9tuctn9 9nhege Canglants
An 9ntegen Comstank mugi have atleast ane digi
2 must nat have a decmal pcint
3 9 Can be eitRex basitiue 0Hnegative
4 i9 Q98umed to 6e bositiue, 91 tRene s no 9ign
Speciied
51Spa ces andCommas9 aie hot alloued uithio it.
GI Can haue values HOm -32,168 t3a188.
Examble550-6G5
Real Con stants: Real CmgtanBs aHe used lo
Hes-
HEgenE_tRe quantitiesdRat uaMy
Hap+dly- he exambl9 oSuch Quantitios aie
chgtances, weightS, height and bniceAeal cangt-
-ants aue alsa Calledas loathg pasnt Can9tants
Real ccmstants OMe utRen o tua tgpeg
HReat Constont un JHachianal JoHm
24 Real Constant in
expmential Jonm
Rule9 on Congtnuclion of Real Cong tants in
Hom fraclionai

9tmusk have atLeagt ane


2 91 mu9t have adecmal chigit
9 t coudd 6e eftRey bamht
þogitive OH negative-
4 Poslthive comsidened a Re delauik sign-
5Commag and 9bageg AHe mak allaued dh Aeal Consi
Examble 54-564,-65-25
Real tomatants n uaohanal gaum ane Mat
adequaBe Jan Hehuesening veny_Smal and ve
Latgenumb@AS- duee n Ais_expanentalaHm
AHe_uged - day Cxa mble 35aoaoaaoa an be
uHlen as 8-5 Eqwfen HepHeenked in
expamenial cs a Heal Cmghant Comtans uo
aHts Manissa and Re exponent
Manhaga f-Paut appeatfng belane e_o Called a29
Manhs.sa
Exponent f- Paut apbeanng qltea k_Called as
Exponeni-.
o Exampe l25-3e 5, e5-3is
and G s expome rt paHk
manhssq_batE
Ruleso Congtuuchom o Real Comgtante
anenhial Joum -
h e mgnissa and exponent
batt must be
sebanaled buchaaacley e
2 he manhissamay be basitive on
h e expoment mustConlain numbe neaative
musbe an gntege of any sn hrch
L he delault signto 6oth manasaand
exbmment is positive tRe
Q c a n have valul asm range g-4e 88 Jo 3ye
Date
Page

me yalid eal Comgtanks expxesed


iin
exbenential dcom aHe te-8e-4, 2-3e2,-a-Se

ilChaxqake_Cangtants- 9n addi kHan to mumoHic


aReo
Canstanhs,he pHOgHam
meed to deal uik chauackeig and gluigg
Chanacken Cangkans aHe Uee d to expnes9 qua-
-ntifieg like mame blace oH genden hey Can
be a 9ngle chanachey OH a gHOub a
An backelagh_chanacken Congtantg- chanacleug

_i ingle Choauachee Cmstant: Any


ehanackero
digit witAin 9ngle
quotesduite be kuealed as slngle ChaLackey
CamgtantSome valfd chanacle Camstante
ane a c'4,2'x'_

9tng chaHackey Camgtante:A gHoup q Chan-


taing a single chana.ct -aclena(Comgian Com-
s called as giutng.
hege congtanks ane encloged uTB double
Quaka liom matRg gme valid
gtHng Comstanis.
aHeHemgnt shia ", q898 5+2" any
Chaackeus oy digilg wiAip_olouble ghoup
Luite befHcaledasgbug- Quakes

Backslaghcharacten Comga nts 9naddihn o tboue


desctbed chasactey
Cmgtants,c_Language gublbaHts 9amme 9peciaP
ChasackQ- Congtontg JRa ane callecCScabe-
gequenees" Backslash chanacten Cmgtante oM
Date
Poge

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
-

-Scanehee1tesmay yan i-A_sa


SOMC
Date
Page

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_

IDatatube tDatatype MebHAGenks tyhe


o be carctied uh Re Vanio
q 9nbu4
b b Ghe
data tes can be ala.93Hied no buimany ol
Fundamental dota tyþeS, deried datayheo
and leex delined data hubea- PanhBengand
Vand data yþee aNo atfier 9ubboHted_dotq
ypeg by C language

1IPHimaHs_data_tybes FouH Jun domenfal aata-,


tyþeo OMeSubþoBed

y alC_LomblloHghee oHe 11 Yniegea


Chaaaciex 8 Float Double þaecuin tlacL

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

ntee dain upet ntegen data tyþes ane usei


fo Glov
numeic data îtenme
hee cor i c e Liote numbeHS a9
r
wel as
TUmbe1 i 1ac oTm2 he. dala
catenou tubes q nis
intege, ho 9niegn, Lang nege
Oo nddiicn in iE ty i e unstgted 9n, unsian
Shont unt Ond
Ord Un9igned JclLa nt dala ty
aloo a l undei i (olegoy y
droCib es ali nt cala
ybe dolioui,g habc
Date
Page

Datatybe 3Bmes
Desclpian
ntegennon Range
3246se Bytes
FHachicmallvaluesl
baf tve andve
to 138 168
PInsignedStones 9ntegeC do 5, 2
gnt nnHactiomaf 535
535
valueg

9Shoitînt Stoneg 9nteqen -128to


manHactfonal}1e7
values botR tve
and vee

4 nsgmed 9tonee 9ntegea h 25s


shont 9ot Mn acHmal
Values

5-1Long ini gtoxes gnhece1-241,48a


values 4ve and 6y8 to
-ye 2,u7,493,6
Awo b r e b ' r

one hundo

GUneaned Glmes gnt.cgexa h 4,24


lmg 9m walueA 91,2955
Paînt dala yhes
2 Flaahfg Pañt_data tuho: loafrg 9tonG Hum
AHO_I900 o
doscnib-
tables
benS UTR JAacicng- allnu9
all ioahno pani aata ybea.
Dalatube DegchipHam Rang aytes
Floa uged lo glohe 3.40 to
achinalval-3-4 o

81Double data tupes -Float daia tybe uêmat Copabt


Sfonihg LagehumeN
Ond loaling _quanslies anHhfs daubls bec+siom
catatybe is used dollonshg dauble daBa tyhe
cencaibed by belu tasle
DAZATYPeDeaciphm Rango 8uten
cdoualeStaesdacacham.al valueaa.138 to g-u
t80s
StaeHgetiaona - too
Lalauhie alueA Lau a 499

4 Chanacter datq tybeg+chanackeH data types a


Ueed fh ghaie Chaadkey
daia items-h e yalues to be gto Hed
OMe enc losed Tn gingle
nAem
quotatian manks ().
cha and Unsigned cha aMe uo chaaacler daa

Oatatybe Desciption
Char Stones ChasacBeH Range Bule
128to
yalues
Unsigned| 9tanes Chaaachee ato
cho Valuen 255
Page

enied daka tyhes Detived dalo ybeo ao


also called as tuclunc
ldata tubeg hemaih dijenence betucen unda-
mentoeand detved data tybes ua diaB a
vaniable al defve d olala ypean handle mone
tfRan ane yalues a t a tfm - wbet@ag a uaiote
undamenlat daka tubeg Can hande omly
me value at Lfne h e data types h J6ig
Categony aHG a1ay9, 9thg9, 9tuctuotOnd unons-

a sey delheddata tybeg hes aHe cfedala


fybes uhat ane delihed
y ge-Shey Contan user dleji 9hectHiecd values.
Enum seywónd use2d to declane data tybe

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

Suntax £HuoH-EHHaH9 tRat lccun uffen yau ic


-te the AuPog o Hitng C 9untax
OHe Rnoun ag Suntax eHnoHg AlL Rege euna
OHe deiectec bs Camplte and tRug
aHe Rnoum
Compite Hno eHHON'S Mog FHoquent 9untax e
1Masing aeniesis3
Pnting Jre vaue o vaiable witfaut declauing if
1 Missng Sernicoton ZikeJRi

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-

inReH EHHOH9 Jhese eHHOX OacuHG LDiCn ake Com


lanue link tfte dijevent @bject
ites wit mang olbiectUsing otsiL +F9 Key
RDNJ Shege aHQ eHHOHS aeneateal UBeN MO
xeCUtable oRe bHagHam cannatbo eneHol
hig mauy be due to wHang unehon þHotatybing, g
C c headey eeg ane a tRe magt Cammo mmo
hReHeHHOM ia imlthg- MatnQingkead qmain(
EXample e linkey eHnoh iS
pHagnam do PPugtaBo
nclude <stdio-h>
aid in Hexe Mainshoued be mgin(L
Infa= lo;
Paini ( "7d" al:
EHHON
(text +o x£a); undeined Helenence to
'mah
49Logical exnaHs On
Combilaticm_andexecutiien
pHogHam- desit@d Cutbut ug mot
o
btained Loñen ceutain nbut yalue9
hege tubee @H@HS Rich aHe qiiep-
pHovide gncoHN
ct_outbut but apheauG to be eHHO
Called lognaP eHHOH9 -heAQ Hee aHe_
maatCom mo eHHONedne au aHe one at Re
pHOgaanMming boqAnOMg
éxamþleOLagieal eHNaNaNe _
C Hagham o HUSHHgke logical Oa
pt Maln(J

inti o
! loaical exia 0 SCmiçdm qfey lob
Foma; i49;i++);
pun4("loop"
Contiue

getchar(l
Ket utD a-

5Semanic eaHoY g+Jhes eHuOn occHS ufen fc


Gtaremens uHitlen n Ae
iagHam aHe no meanihgue a iRe CampItey
Cxample_oemanfic CuHOn ig
e pnagHam to I£eugkhiate Semanlie oiHOH
Vaid mgmy-

int a,b,C
A+b=C llsemabhc eyHan
CHHGH
CHOYualueequned a9 lejtapbeoncd a asanm- N

n t otb C; IlSemantie Eruo

Houw daeg apHOgHam Exe cuto8: uheneveH Q

'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-

4ObeHaBaHg=-Hn _apeAgto is a Sumbot


Rar 9nstnuct9 utfeLmbitey
Jo peaanm a gpecito opoHation: Jhs aeai
yoHea it6 tRe tybso_apeiah he main.
pratays is man+putake Re data
and uaH*OAleg-

2ExHCSSIan=Jhe_9tatement Camtaining vaHTobleg


and obOMatoHg calleda9 Qn
CxpHe99*m

beg- he9e aHe HepY-


Cgenied bs belo Jigtue 9ncHease T
Lceciement
Bit LAitRonelic lGheciae)

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-

aAddifiom aboHatoH Additiom abeiann. U9ed


to add uo oH_mae YneoeMg
an loale.
bSubtnaction oboHatan Subbnachfon apeatau
uGs e d
USed
o calculole tAe didenence o
tua numbeHs oHlaatg

CMuPiplicahiap_obeHao MuPHblicaham openalon


ueed o calcuPafe he bHodue
u0 0 maHe 9ntegen9 aH laate

d Divisfan apeata Dfvis+om_abenabn e uged


calcutate thBe QuatienE otter
dividho uwo numbes dhie aeHalan bog na Cmce
witB Hemginde le attedieom

eModulas opeHa.ton i- She madutas difgfam_cheadki


el"eused o cale ulote
e emaïnder
erJet ale Re disom
uO_mumbeHg hie abenata hag no Can
CeHn wiR uaien en ediASiom
Page
uolaianaf abeHatan9+ Relational
USed to
ape HatoHe aue
Cambanson 9UeHY cambaue tua ualuea
Q acls as a base aQmpOHtant in aHogam and
execulinq- Centain glalement
N
hbHOgaam An expHCM*m_Cmlainihg
Helatiomal cbeHalok us called One on maHe
Relahiomal apeHataHS ate aanelahiod exbremfo9
Eaual to abeHatont(==L 6 Used ta
Combane ua
9Laniies aHequality.he exbHE
Ssim LIPP ueButn EHue 9 Combaded
e9Lal ualue,- afeHie
uazableA Comtah
expHexrm_HCAulE EALSE-
21esg ffan ahHaom<:Cmbates Jhe Vaosleg and
HeguPts TRUE, IY Ae value h iee
iaxable mlet Scle q apoabH S e99 fan_ value o
VOHOKlo_þHagent gm he uighi hand 9ide o Re apeaalao=
3egs fian oy Equal n opexolon Cambaren dRe ouo-
n i e and Hegulig HLe
nlue aiable m lellside of operalor ig lemRa
eouol to the ualue af asfable bHesentonJAe
Highthand gfole ql e abena lot
nHeaBey iRan(): Cmbaes tne vaniaálea and Has-

UPlg_dHue 9ualue n a vartiosle om


lehgide obetalan t gHeale tRan (he 9/dO vaiu

y0iiab.le bue sont gn heHght ha nc


Otoralon-
5GiHealey Ufan oHCqa to opexalnyt ambanen
HRe Quanifies and HeSufts tHUe, 9 alue in h
vaniable am lejt Síde a ebea loH iSgHealeH hon
OH eoua o tie ualue oVaiable pHESent_On
Aeighihand Side he ateHalo
&Notequal lo ( Comb.ates Re quantiHies and
-uPts RUE , Re quanty
ket efde o Re benaoy fs mot
equato-die qQ4
anthyHesent om tfe ght hand S+de c Hhe abexa loy.
agícat ahenqtan9t C language
a
i9eq,ulpbed uil
Subhant yon lag al obeaalas
o nD mutHple cmditianal
GeHalaue aHe uged h combthe expHessioms-Ghese
tuua aH mOHe_
Helahbmal expnegsionga HetuHD Re Cmnhed
SHeSuPIg q Re Helafianal expHeSSION9
ukom ne abeHalaH LUSed LagicgD debendino
lagtal expHe&*mS, Luhicb ue9utkaiAeHaperatams oam
ue aH alse
Logicalabeiaon OMe19 And 10A 31NaT-laq a.
alpeyatoHgaHe ugd h Comnett nelatiomal
AN0 cheHatoHf- Combhes uuo expaekiem
on mOH Helatona
a
CxpHeSsomg and diegufkg_HHUe Lnen
JAe Holoahänal exbegsang
-twn Hueathenuse YEJHetuHng îhdiiduollu e
dal 8e- q SB
Hebnesenled by
3 Sumbo: Jotexamble the
Re exbnesaianLsY&& z)"_uiP
P_Heg uW-
TRUE ( Y ) s 1Ueand (X47)
elee, t w t P HetuIn alse 3_alsa tue
toH f Camnhe9 fuo O
mOMOHlabtana
eyloHe9S 1ne_Ond Hesultg_tue un
Dutc-
Paqe

1AH me Oi moHe Gutelahonal expHeagng indiv


-idualyJ1@Buinu e 9E Jetutns JatseuußRen al
ndividual Helaional expmeegms d1e3ul înhHafae
S Hebuegenfad by| 9ymlat

Helatiomal expuc39img gusineaales


Re dhtaned Hesutt 91 *s ushHeseDied
exclamathion Sumkct1oy exambe exhueasic,
LuiPA _Mesuft ofee 9 x is gheale Rah
y anduilb Ha8uPt_biue,9 is lea tAan Y Sso
Hegup S- exacily aphag+t o o tfiat d1<9

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

OHfimeto apeatoH9, C also bravides Sbecal


and decHene ting
Jay9ncHomenhg
OMS Caled
Re yalbe GBoyed h vaGblet 1s
fsColled decac
OCeen abebdlon Ona
ObeMaiaH PHecedence f-
OpeHaton pHecedence
Aelemheg
delesm lneg ufich ateHaton g
peloHmedl
inS
JiHs nt an
an
expigeion_ wiR_MaHO A a n
One ap©HaloHg Luiti_olHHerepE Meceolenee
CeHtain opeHaaHS have highe pHeOelence Aan
olfe aHexam þle fs mulHiplica Hion apeBaton
ha highe bi@ceolence Ran addihm op@bahay

aH Cxamble X= 144* Xs aMined 13


Mat eo becas a p e baloy han hfgb@ phec
endence tAan tsfeaanza: Sa S t mulh
bled uitA 3* gnd Aen addA îho

CakegaHY- apeHaloH ASsociahivb-


Poahix L - z tt. Lel o night
UnaHl
Mulipicati Let o Hghj
Addlihie lelt ta H1ghi
Lelt to O ht

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

Calcutale tAe yolowing Cxpreg9iarn In c


Language pHecen dence

9 a + 2cu/1o-3la
lan t 2ao lo-
lan +2o-Ro

PacgHam in Cc_dfte expHes+cm o C


9nclude <gtdia-h>
9nelude <emla-h>
Vafd main ()

9nt a s lmb-2cn C -lo a:3e =lo


HeiH-

PanH"Loautbut is=%d",Hei)
getch -

05o +3a0 2 t450u Lo-35


250/5o+ 6aD + uSoqota = 3S
5 t 6oD+ uSootn 8S
5 +6om t 3g-36
6o5-5

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;

hainH"nautpu a xpdsion is= lo l"hiea}


getch[l;
e Camueuaian in C -A ube Cast F
Velan Hom ano fype fobagieally aCom
anaie- Sbers
fuia tybeg o tbo CamueHS*on-
99mplicik dube Canyeaion
mplicitupe CanueHsion
Boall
chau
Shat ant
Gnt
Unsiahed Jni
lmg-
Ineianed-
lang tnsroned 9nt
Faat
aaublo
Lmg lauhla
9mplict ube Camuenalam is ala
Gutomatic ubeCanueHgim. gmblfcit RhaD a
CmveHSram 1Sdme b tie type
CambPer yHamm
CmbrLeH
oADu+RautaHy_ext@xnaltHf@gey an B-
aD i8
4e UgeH- his
bla
CmueHSfon
when h an expHeSgtomaenerallu kar
mo dao ype 1s pHeAent moH JAaD
Gn Such_ Cmditio
tubeCmuioD takes blae to avend
data all 1Ae data tybea favandLas-
Las
i e van
a dedDRe ab
Vamable
data tpo 0Ae
amiable uit6 langest dala hibe
DoofchaH38hoHt IntAnunsigned 9ntlon9 unsIgred
Lomg
Long lmg ELoatolouble lomg double
JE s poseible Joy 9mblicit Cmvestoms to 2ose
QnoHmation9igng con be lost|uien 9igned ig
Gmplic1tly Comveyled lo llnsignecd)andOvelouu
Can Occ UH ufien_lamg Long 9 gmblicitly
Conueted to daat.-
Example o gmplicik aupe Camvegiom
ILExample o 9mblièt tube lomueug*m
Include <aBdio-h>
Vaid maîin _
nt x= l0-
ChaH L='a';

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

Shie bHoce Sa _alao Caled tube Cagthg


and 9 is useH dedine- HeHO RO UgOA Can
huhe Cast he HeSUeL o make+E ofbatfcuta
daua tybe
he Sintax în cs
upe) expmesiom
e 9ndieated Re olata type to uhich e
haMesufi 19 CamueHfeq
E9nclLde <9tdia-h>
Yoo main (_
double x=l-2
9nt Gum =(9ntlx+1-
PanH(" Sum= Jad,Sum)
3
dutbut&
Sm-2
Advantageg oype Comvegicn
hfg ue dane to taka advantage al Ceulain
Yeaues 0tybe hieHqHchieo a àlupe
(HCbCgenfafiong

helbs uug lo campulo exbHe»siang Conla


9E
-nh9 Uanables o dexent data tybes.
-nihg
Dafc.
Page

Chapten-4
9nput and Output opeHaHons

Cansole 9nbutloutbut n C Ptagnamming


n Ondey
language Cammpact
t keep C PHOgammlhg Helated lo
Dennis Ritchie Hemoved anytRh9 tRe
oH Oulput om tRe
denihan o
9nut nopHaUsions dos
language heNoHe Cha
outÞut
and adata Ham 9nput anol
gnput satue t R i s Little
autputdevices 9n oHde fo
dis.cH@pacyCdelelopeXS d e e l o p e d S e v e H a

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

gnput defceg Lke KeyboaHd prrav


and
HO UisLLal clisploay
Unif

atbul o autbut clevfces ike


llow US

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

1 FoHmatted Cansate 9nbut unchiam -


SCanE-Scan [} is dtfe oHmatted Lam.gcle
Anbutunchon uwffch Heads onmatle
SnbutHom Stdlin(Standaud 9nbut 9 Can ead
any nlegey loat, chatacH ShHing etc
dHammffe Usex-Jhe Suntax_o gng data
ScantL-
Suntax
Scan ("Foumak
ShecHfen",Mgumenk adduei)-
examble
Scan od', &Sum;
9n Ris examble
od
an9nteger- Mum s doHmat Sþec1ley 2oH
9ndicalesuhe
hum heHe ua)ue 19 o adduex od
be gfomed
VaHiable mame Dum under tAe

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.

e PhnQI: PHin sRe danmatted Consofe


outbut unchfom
oHmathed outbut to_Re uffch bHinks
can disþlay SnlegeAS,gtdaut Standand outbut
Yloahing pat Values,
chaHockexS, etHng ec ag9ndicat.ed
lgo be Suntax quglñg n t by JBeJRe
is as Jatlaus
his
pHnt(4ex"
sholl gmplu puhE "Jext"m oitbut
9n aHoeH ta pHinE any Vaatabe Value See_
almg uilA_
text e havehe atla uingHaHmat
pHnH[" text <joHmat Sheuez" uaniable
his shall pHME Re Value o fe lana ble in-
am.at gheciied by doHmat Spec e
FaH examblo pHIDH ('maukg: od maubs)
his han dfe oMmat Specy ey a9 Jod A h Slanc
o 9ntegen dala and9F wile_bHnt_Re maHka_
gotegen doxmaf

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

getch Y: qetch() Hunchièm


is alg0 untutn
untot
an

-Hed 9nbut unchion Suppotled t


chaac
unciom Jt@ads a
CLanquage-he
does not Cchoe
MOm Re keuboano and
foheSceen -9 s pmesenlÎn IRe heod
Conio-h. Jhis u c hion Hetwina fhe Chum
Chaxactey Rat was tuped Lasl 0 tab yhed
megtHecentl
Examble
9ncude <shdio-h>
9ncude<Comio-bz
Vaid main(

PinH Youn name is 9hubham


aetch

21getche cicrel) u an unioHmalted 9nbul


nChorn euphoted by C lanquago- 9
on unbuee d 9nbut devi unetfn-his
unchan ailso LuSer to rem a key
n tne Keytod and n9tanf ly ttanse
e vaue into yoriable hig Juncon
Same Os gefchl ohe Only dadeMeNCe
ha 9 disp lays
tie mogt eCently used
chaocte 9 tS ao prent 'n Comlo.hr
N
qs dul!eHenceHmgelchalI Func tion ig iq
qt cloes atHCqulbes pHeslng oentey bey
the chaxacter.
alen iybing

Syntax
Vafable Name = geBchel
Example:Chan He
HeC = getche ( ;

Cn execulino abave gBalement tfRe KeyHeed


Ueer UiPP be axMLgned_a vamahle He

31getchan(: getchau iS an Untonmatked 9nhu:


un.chdmeuppoed by C Languagehis
S bueed 9nb1ul ouHput Junchom jhis Jincion
JS uged o get_oH Nad a Sngle chatackH
Hem he sandand 9nbut deufe@. h e delinitim
isunchon S gBoed h header t e std+o- h -
elcha 1 19 0 macHotfat wonke uh o Smi-
O mann@ 0A getch) and ala dishlaylCchceal
Re chaaciey but t needs the use to puen
RC ento1 Re4 ale thie chauacker

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

unchon Daik lan the aso je x3a


Date
Page

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);

51gets-he ges aunclicn us used to


Anpur
sting9 Omn IheKeulowtd
adva nlage hi3
o
Shoye blonR Space
unchon
OU
9 at gt can
Qn h ay, 9t is betle han
han
o gtoins
to do
{Me Scan
whichdalls Game
Date
Page

lla giHng 9nbut [sngle uaud aH muPi- woHd


HmUgeH- 9t feHmihales wAen eptOn Reu

Syntax
getelStHI0g Dame )

ut9 he puls(9Junchiom s ueed o b u n Í


SEHTngg an he 9tandand display device
[e Rat 9f
h e oduanlage leing Re uncftom
allemahcalls u H a new Lne chaHacke
u da-
Ou
HmE o he aBang- baing disblayed 90
QE e
but aluaug appeatA i neu lino
usedto bunt Smng o
uo Comsaie -

Syntax
puBlgBHngname
Foumat Sheciieo 90 Hene'S a LRat
liat oo
Cmmamly Used c

data tube ad tReiy amat 9pecire

LData tyhe foHmatShecieA

21 Cha o C
Q Loat foF
double o hd
sSho ant
IInsfaned gnt
Page

Lam.q 9nt %9d


Lam unsigned gnt
Lm Long 9nt ollu
Usigned hay %C

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

Comtal Statementg Contxal statements a


the Gtatements which
AHe lged fo CoptHal tfe lo
xecuti.
-aD a Re gnghiuchons HLEEeD_n aþrog-
-HamSimply Ae AnsBnuotiems ae exceute d
Gequenhially. his tbe CantHof ghHuctue
ug knaun ag Sequence Comtuof shauckne_

Cantual1
Skatement

Banchin4 umping- locping-


oHdecisic Shalemen ISBakement
making
SlalenenBs
LBHeak
tap
sta- Cankinue
Hement uile
Gia tn_ LLanp
19 elae sBalement
9 Clso i staement FaH

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

Jumbing- dumping s a puocedwe o taan


Cambiot Fo a

pafic uta
etng
boîn n
execuhon
pHOgam-hig ds done
ntax

tinough umpihg-Statemen (Can die

31 Loabihg - Looping is a Heeating


þHoceAs gtarement
a Set a gtalemens Uoi a Condif SHaTemen
-on hotd tuue.huee ypen o laoping 9Bakomcah
aHe used to accomplisb i e 1asR
Statemen.
lecigi om making StaBemenBs: aH Selecham CmstH Supplied
AHe Used JaH Hccomblie
bHanchïng n cpHagHame- hese glalemen geleei uie
ane o he tuo aH maHe execuhóm baRs,dehendim 9Lueto
on i e xes ult oCondihon-Jhis means, i *
Canditan_e tuue, Gne get q Staement is execuued
and i tRe Csnditfon ts alse, atfe 9el stae
mentg s execuBed: pMovides dollouing deais
maRhq Stalemen

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:

Statenentand e ilfe be ereculed_mly e


Supplied Canditfon teguf4S to tnlue. giñewise aBe
wfiale block witt be skiphed and Erre execufiin
LuTPP Cantihue ate 1 block Belou louchat
9Lluetuates the Use q Simble9 gtaemenf

(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)

pHinH(uou ane hoss"]


pHnLCamgaatutation

sich

9LlugkaHom Pyoguam 9np1tg value o manRs and


GoMenin Vanïable marea and
display
he memage o Pa and CongHatulateng, 4 fe
ent exed manRs ate gre alea Aan o_eQual b
35
9 Ree mly me staherment indeu black
tAen neHe us No Need o þut i l y 6xaceo
hey aHe HeajliHed onluyUfen Re mumbe
o Statemen kS jo moHe Ran one
Date
Page C
o9Clse StaBement -9 elge
a Cangtuek
CanstHck is
Cancljtiano
sals.c
alac
c language JEis Uged CmstHuet o
_fo execule a set o
GtaBe ments,91 tRe Condim
olfer 9ek ig tue Ond Sone
oStatemepte,91 Re Canditfomds
alse 91 elge cmgtauck
Stotemept 9t 9nclude 0 îs_on extengïom o
block to be exec uBed uhenComdfian a gtate ment
nd a Sta tement CamdiliomuS d e
block f6 be xeautod, 9 tRe
Condikon ue Jalse
Syntax
candihion)_
Stolement block

else

IStatement block 2

he Canditiam ie Hue Men gtatemeple fa ie


HSt blocR _wiee be execuBed and 9 Re landion
NSalae Ren Re gtatemenks Seamd
black uPe 6e executod-i elge gtatenent
iG
lsed in Re Sihuafong LusfeN fie Comdihomat
Staienen can only. hqe tuo pos3ble Mesulk,ame
Cxecuim palf fs salloued ufen he at egul1
ASObtaumed ond otfor exocutton balf soloued
wAen Re SecomdueguPL Y3 abtained: bela
Pustaake
Elowchaut of elae logic_pHaqom tushae
Canghuct
t e woxking elee

Entny-

NloCmditim Yeg

NExecule stalemendkled xecule salement black 1|

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.

/PHogMam to check uhelfex a numbeH is eveD oH Odd


9ncude <gtdio-h
9nclude<comio-h>
Vaid main{
9nt num
n ( n Enter 0 mumben")
Sean[ "% ,knim);_
ate
Poge

9(numo2 --o)
pHin H\n You enteHed even mumlex");

elge

Painy"n You enteted Odd numbe";

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

3Nesed 9 Skakements-wfien an 9Shaement


wïtten 9nside the body
afex gtatement- 9 Called negted
Stalement 9n CaNe oncate.d ( Skatemenk, lfe
gnne Statement i9 executed mly iuthe
laute evaluakes to tuue Belouy PHOQoam itu_-
aatenAe Use o heated i staiement

P Hageam to check whelfen a mumbey is druisible


byeand 3
9ncude <Stdio:h
nclde<Comio-h>
Vofd mafo{I
9nt num
Dote
Poge

panHn enley g number";


Scan(od",hum
hum =0)
painnentoued number fgdivisible_by 21
hum3: =6

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 "

eloe (lmba35)R mks<U5))


pin"h Yau hove got c pode

elge 11 (cmkgr 45)&&mk946o1


Pain(" |h You have gat eghade
elee (nb9 z60) nhau

prin n You hav guode")

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.

PHagHam to Check ufe Hex Entened charac te


NsVouuel OH Cm.sament

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

enat+an oH laapng Canstnucts: he


Cancept ooy
Concept
executiem
a
a banlioufan blockHepeatihgJhe
q glaBement ti
QComditiomalexþaewlan
1exatim oy laopfmg.is satisied19 Colkea
Colkeg
SIze o e pxagHam hlealoapng ComsoucH dcdu
HON pHogammeH'g mindand6atneHatimg
D lopife
taement needa to be wHitfen
nce and loup uiPe_be execuled a hnes omy
belauu An Combuler aN ghm
baogaamnng, aLoxop uS a
Sequenee o nstuctians
a_ceHtain Con ditiam i_ tRat is Hebeateolntit.
xeachd
uhes oloapgNhewe aHe
manly tuo tube
aops=
1Entuy CamiHaled Laops 90 his
tyheolaobs Re-
tegt Cmdihon r s teaed
enteihq tie loap bodyolcap and belox
aHe Cnbay Conaratled wflle lo
laapg
eExtt Combyolled laobs 9p Ae upe q
tegt Coondi trem
loops JRe
evaluated aB tie end o oop bod Ahenebhe jeged ot
Je
Loop bodu uriep_execute gtle.at once, iaea pech re
uRefey tRe fest Candi iam iS aue O
al se denile LOTp9 exit Couta-ed lasp
Dote
Pone

Lagbs
Entmy
Condnailed CxTt
Lntautled1
da uRile
FoH
LwTLe

koHintializatian;Conditiam wAIte cmdi tion


updalian)
wiite (tmditican

Fax lacp Fan lech s tfe mot pohufan


loopng
BangtHuck- 9E f ey_dijexent am
ond da unile laobs: Jhe main 4ay ufile
ntage a l
i s tfiat 9t comtaima all Re if uee phosea loop i=
9nqlegkep e Yahal~e,cmditian and InCHemeA
bhase aHe Cmtahed h 9ihgle 9tafemen oYAis
makeRe 9untax of thRs Larop a bitginple
Ran Re atfesg. Jheua JS mr meed q9nhalizo=
Con.clihiomal vaa+a
bleinstde o tgidle_Re lou
bady the Synlax oa laup 1s
Synkax
Foh[in alinatiom bhase:Cndition.þhaaeSntkenenk detac.cme.rt jh
laa body
nihalzatiom phase geneHally eomsig k o an aA
Mign
iyn,
tfAal wilp
menttmclitiom_ phane Comtans expuesTOm
be_legbed ts caery out loopmg-Jhe 9nOtemen)
decbCEn)
OY_decHement phase 9ncremenk a
Whe nliq
tRe Value of fie Comditional vaiabo
lizatiom phase ig cavui@sl aut amyoce n taa oh
Ente

9ntalTee

Conditm talge

Hue
Body o tRe
lotd

gncHement/
Jdecnement

Ext
tlo chant yoH uoMkhg_ ton lop
Paga

PucgHamta llustate the woykihg a Jo lagp


I PhagHam to þ>tint hella wonld 1o times by uging o
#nclude <Stdio-h> loop
mdlude* Comia-h
Void maln()
Nnt i-0;
a i i s la;it)
DHnH Hello world \n);
Hgetch|];

file lach-wAite studing o laap ue ha ve Seen


hat numbey ihe Re] +tenationg is
RnaLbetanehand . Re munbey q tinmes the loab
body neededto be execuBed ieRnown to
uguhite laops aHe uged in situations wfeve
u e dam't knowu Re exact mumbeH Q 9texatiu9
L Lap belouehand h e loa execution le temi
hated on bagis q test Cmdition

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

Examble pHOgHam 5-_

PHaguam to þH*nt hello Luold' uetng


Ehcide <gtd+a-h> ußile loap
nclude<Camio-h>
Vaid maîn L

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

Jhm 1 to 6and kipping


þrini numlen9
/ PHogHam to
umbet]
#hckude <stdia-h>
include<lanio-ha

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

Flow chaxtt Examble


Pangaam to check numben Ts even c acdd ustn ggobo
laopbady- etatemenh
LShaHss #holude sstdia-h> Flau chat Gotasiaiemant
ndude <lania-hz
Comdifn to
Voad mainl CStapment b
ContinUe nex Conhi
tetatiga -nue nt i Label lcslalçmens)
Fatye clasc
IExecue temaning bany ("Enten tRe Vvalue qa
Sean(qod"i)z Label2`aemeot(s||.
lhaato lacp bady i/%a=-o)
gao abeli; Lakel3rtalçnsnis
lse
3Gato Stakement Ahe oo stakement us use da 9oto labele ; LRest aRecad
allen Hie Aeqence Lable
Ham and
aCag
-
StaHtepecLubioa m a deA a n Numbex îs eren");
label:
-puts[n numbex is add"
getch();

NesBed i law chaut &-


Staut

Fale Camdhon

Cmdi-
9 Camodtfm
him3 Hue
Fabe Stalenent|
C_
Fabe Stalement A

selement Stalement
B

Sialeren
ChapteM-6
se dened unctam9

Madufaxiy -Longe PHogMama ae ddided ht


multible uneHons, to Solv aboue
atated pHahemS nSCmcebt fe called o
modhueaxity. ghe Main bene modulaitu
ia panallel develapmenl9he-eenesph can be
undexatoad 6y apiact+eal exampto

LMan PuagHam

Funchian Funch Funchio


2

Funchian A Juncian isa set statemen


peHianms a hantfeuPan task,uhen-
-eve Called: he unchom Ús an 9ndependent
Hagam tfiat can be Called bs otieyJunctiny.
Any LaHge pHogHamg Can be_diided into
OH maHe SmalleH JunchcmCeath a
HUD and
*s smitian o hiafng o peHsm
and
uncho
QRing him a athular luask to pecm Nh
uñenerer
unchcm þeylonms a pasticulas action
Statements
Called A Junchcn is a get o
language thatpegons a
wMTtten in_þatfeulan
panhcula task_,wienereCalled-
Date
Page

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

LnueHSal uSeb- Some unahcmalis


In_mOHe Ran ome
mayhe neadod
OHeSme CommomtanRs h þoguama paguamS Jhexe_
of g/mitlos
ube-Lunien e CreaBe a Junchfm and maee it q
ant o T6HaY+ tRe unchom ig uniierSally auailab-
-leto erey ngCim

aMadulaiy- 1à a buooeM of dindng a h


pHOblems9 nto multiple gmalfey piasns
IMadulanîty ig Re maih benolit bncled ay unctin
4|eamwouk B- URen ue dRide apxohlem_mto a
NumAe tunchomg, Re codng (an
be done h baalle aany people-hrs
HeducenRe developmont Hmeand9n.CHeaeg
t Spit_oteamuone h doreleherg

5|lehngaunctianDecdanihg oa llse delhecl


N
unchonne loanguage g.
fhe
eHyEany-olonunnq19 Sunlax q detla
-ng a unctiom m Lang uage

Hetutntube junctionhame (baàamaloy lis


hody f Re uncton

Juisi o elemenls tunctio


tollonuin is tf
1Retnube-Adunttionma etuat a data-
Jie dala.
h e ehuxn-tybe t
Juctom Sme
H@tuinG-_bme
ube R e Value Re cheraho wnlou
uncham peytahms tRe deamed
cobe_ c a e _ h e Hehin_hybs
eInAg_a value - gn
h e heyulaud vaid--
Runchom mame-9hia_istte achual name
R e n chim he unenon To
and Ae baàameten Rat nge1Ren Comeitue JA
unchm Sfgnatune-
_3 Patame teyg f-A_Patamete isf ConBajns \am-
ble^ Aat CaHMY NJaHmafnY Ho
the mah þHOgHam_ o dunct+an
Hunchcm bady-9he uneho hody
hm Cmtaing
o StaBemenls a - dlne
a Cotle
Re uncim doe lufat
Example pHagHOm --
hk maxt num, mt
mt HeAult Muma}
numtz num2)
HeAPt : humi;_
lee
HEALUa Nume_
Hehin uHeAult
Dute
P'age

6tunchioan Declasialiang- Junction declaaaticy


Hell Ie Cambrfe abot
a unclion name and hou fa nlt e Junclim
he acual
he body Hheunchom_ canch
dolhed gepaiaBely.
unchom declanatian hos Jotlouuing paH

Hetuintype unctim-namebaaamejen lisi)


Cxamble don above stalement

mt maxLmB num imt nuna)


I|Fun.chian Call B-A Sunchon all AS a special
Slakement uhich is _LwHELten
_dn Calbhg junchon_a a baint uheHe
AL unchan ally_o unchon s meeded
unchon bady _lansisBs 0 Aeachual Slehemenk
Rat uieP he executed bs Re Junchon:dhe
uncHm uam uf fch IRe call aunchm uis
nade us Called Calliho Juncht and tA e
uneiamRat haa beenCalled s Catledl.
Colled unclfm
hen uSey djhed juncong Calicnus
Lse demed uncitong n VauioL wayh*
-ege ae
unctian uitR mo aMOument_ond no ehun ybe
23unchan_witi nO QHaum.enks andaHeUHN_Hbe
Date
Page

unchns uilß_aMaunenh oand uil no Hetuan tyte


uneicms_ui t8 argumenH and uilA HChuan ype

unctm ujlR no anqLunens_and no uetuin ybeh

unclfons uhich_do mot_take any data ilcem n


Callthgunchicn h Re dom opad.amere19 n
da na Hehun_anuRhg to Callng unchon a
tey execution-AS Aee_ unchomdo not lnia
any ada meleis, a pa a embhh6naces Hollas
R name uncuncho

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

unchfom uilR Na0gumenlS and aHetuun alue -.


Yhis tybe o unchom does mot takeany uale
m Caluhg Yuncion: JHter exeeuhion, theu JHetum
Ane Valuè to mafhYunchm- he dala hybe
uchimed value _delemihas Ac Heku tuhe o
unchon

PHaganm

nclude<Sldfo-hz
ndude e (ooa:he
Migeamuml;
nman0

Heult
gaeotnum ;
=

panHhe gaeaBe7 Mmbea is adtenult)


JHehi0-
eanuml
h 9Mcaenu m
panl nteu 2 nLumbexg iA ad uou lwant to 0mae
Scan ("d %d,& i,&i)7
geaenum 1j1
elee
qHeatenLum=Ji
H e t m gueatennum;-

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

bainH 'Gnten numbeng hal yu uant to Compat..


Sconadhd&1 &}-
GHeanum [i,Jl-
JHehuin0
z, fhty)
Void gMeainn/tnt
1g uy}umyoou
o unOC
P'T}unujooKb JTIVOLA
Y-OP}S>PTPY
-WUROUR
ST
Date-
Page

JHetuan X
elae
HetunU7

HctuaP banametexs - h e Vaxiàbles wed paA


njoumahan amhllng Juncion
he unchiom aHe_Called Hchualpakametaa

loEaMmal pauamekeug f- She vaH*ablea Gieated n


heunchion bodu e holol-
Re Vale oactual pManokeus Ae Callcd
malbarameleas

1Passtng Pasameeso Juncliam t We Rn.u_Rab


aHameteng_ aHe
|bassed HCm calling yunchtom le Can call a melß.ad
unchan_ jh Fuo ditenehf way

a l l by Vahe helRad
PCallby _ejerence mehdd

11 Call by Value mefßadnall by Value metaoed


aCopy achual angument
Heaed andbaNAeaTO Hmaatqumen u
Junc hon diniom: hua a Cacb and _a
uhe A_Capy Value J`lHeated _and
Qument
POTTOy TuT pawo
te.

Call bu teletenoe metiod I n Ris


meliod Collh,
Cql
gdduey
unchiom, hie
a
ackual angluenls s pamed, nglcad of CHeating h
ugumen/ cthe Calledunctian mak
COpY actu al and
Changes diretlu ta Qchual paoamas nc
rope,
þnocC JnLHCa,.
padmekeNG_aMECHealed his
*he jjrieny o bYagx and:

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

RecuHSian i-RecuMamS _afechnoue Rar


Invatues a junchian Calung tsel
its bady Reaunsive unchan
isaunc
Calla icelt Ham îts aLm bndy neuncicn c e a
an Callng tsely He a banhcutaH_Cndihn hatda
tHue

PaogHam n CaleuBale dac tan+at o aNumken li


HecinSian
Einclude<stdio-hæ
Encdude <Canio-hz
ink Yac[nt)-
intmainl

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

pnValue ofa J%d,b lod and g J%d n4,5,0


=

taNage Classeg În C-Statage clagees ih C a


uged to_deteumihe the
ehme,V*eiki£ity memaHu focalian and ubfiat. Valug
Vasiable. -Yheie_aHe o tuben Stonagg
Clagees in c
Autamahie
e Extenoa
8Stahic
uReaise
SBozage|Stonage DeauRt Saabe te fime
clossesPlare Value
Auto RAM Ganbage |lacae uAîn Junction
alue
29|Exien RAM Teno GlaboR Tie end q
main þiog
maybe oleclaàed Cuu
SHe In piaqHomn
31 9taf RAM Teno localte end o man b
9Ham, Retais valu
behuu een multpe
Hunctiang Call
4Reaiate Registey Granbagelocal uwiR Re unc tian
Value

utamalic b-Autamatic vaHlables aHe ALcated memany


Qulamatiaally at Huntihme-dhe Vieikieitu
autamatc Variables is Limfted to he block in Lfrh
Aey_aHe delihed h e Scape oude autamatio_
Vafa ble ig limiBed to tRe black în wfiich tRey
aHe deined: Jhe aulamalic Vaxiablea OHe intialired
fa ganbage bu deautt-he
memony assiged to
alutamatic Vanlables get Heed upan eXihhg qHam Re
block-he KeuuaHd Uaged sai dehing autam.atic
NaNables is quto - Ey@ locaf vaH*able de autma tic
n Cbu delauek
Examble f
Fincdude <stdio-hz
Eindude slania-hz
Vaid main )

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

J n i k e d to 7te defhe etatic Vagi


gtafic Vao
baf variase is uned to dejihe
d e c l a r e d -h e
keuwoxd

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-

31Registey- dhe vaxYable dened as ugiste- dfte


ig allácated l e memo Hy fnto tfe CP-
HegisBeHS debending uon dfe Síze af Re mema
SHemainng n CPU: We hot deHeleHEne JRd
can
MeqisieH vaH*ablep l 1e twe Cannat use abeaae
Hegietey vaniables Jhe accegs ime dHeqis
vaHiables isastey ufan autemahe vaiablen--Jhe
ntaf_delaut value qHegisBen_ local uaalable is
She "Hegiskei keywotd is ued Jen vaaia ble lont
gbE
shiedbe gtoed n CPU Hegise - e Can Can gboE

ofnfeug n to Hegisken[ Can stoxe


Hegie eH
a aobleD Sta tic Can mat
yaiable_can matb£e
addeeM
hul
P'ae

J r e u e Can not ue mane


slated nto TRe Uegelen
o Same Voa6lea
tRan ane 9tonage Specien
Syntax -
Examble Hegisie dala yhe vaàiable-hamee
Encdude <stdio-h>
indude <Canio h>
Inl maih [)

Heg igte Dla;


pint"ad'yal
4ExteMnaf he_exlexhotstonage Class *a u9cd
ta tell the CombifeH tRat Re laniakle
detined as exteHN ig declaned uitß ab @xieynal
Jinbage eleeufe o Hogmam. h e Vaxiablende-
-clae d as extéHo aHe nat located any momaxy
9E is onk detlaaliom and nkended ta sheci
Rat Re yaH*able te deolaed elseuheHe m »ggdauny
ttie dejaut iota value q extounal gnkegual
type is0 Otfiofse Nil: we can mdt fn halize
the exten_Varïablo globaly: we Can not»tlalize
Exkeunal yatiabloo wiAih_ny black o meAod-
An exteHna Vasiable Can be dedaaed hnny tme|
but corn be ihhalized ar only m 9/ avas0-
0.
ble ig declas eda e xteanal hen Compites
SeaHchesjo a t variable lo bo unhalized
Smesfiene þ1ogHam wAtch may be exteaby
Static 9 E fs nat, tfien ConpiPerwil
h cuan eUIO1
Examble
include< Stdio-hz
Encdudelanio-h 2
Notcmain
2

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

An aMHay _inC ig a Catlection a Smit+ai


19AHMay-
dalaitemsstote at Cantiguous memouy loca
elemenis Can be uiccessed tan domiy Usi-
-fimg and
Jhey Con be Uaed to Stoe
hg indices q an auray.
ng
Callechon Mfmihie daBa ybes Such os int,loat, double,
chan elc

Declanahiam-e Ha- 9hexe aHe difeent ways to


declane AnHays in clanguage
declate anaNnay, we mugt pHovidaatlouing n
Hmaiom
Daka tybe a n QNHay
he name a tRe axiQu
3 he numbey o GubecHTptg in an aHaL
4 he maximum value each SubgcHipE
like otfieH Vaniables îh CanatHay_has to bedecdaxed
heJome it is usedYtlmuing is the S4nkax da
dedanng an tHaY
DaBahybe> *aHay name
Examble
Int gBudenlto
Decdaes an avay student ef nteqen_dala tybe thod
Con StoHG 50 elemens. ahat meang. i s Quivalent to
s So diteHent Vaniable 9ptegey lubeEach element
R heANt aNHay has a Indexmumbex wfih Slanks fHo-
0andgaes upto n-t Eachmembe_can be addneued
_Gudentla, shudent.studentta andl So on he
Jhom_0 hol
aluwayg Stants
Jndex numbex e_ axNAy

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

Jhe humbeyo valuea


lements fhat uede
laugeyhan he Numbet
between Squaxe bnackes [1
elaye JeH the axay

yo Omit Re SYze ol aNay anaMHay uSE io


eheughbheBd Inhàlizahan is CHeated

deuble bal an.ce1= 1 laoo-c,2o,3-4,7-0

e can aign_a 9ingle elemeDiqaxHQy


balanceuj-50-0,
Accessng Aay -A Sthgle dimensicmal ay
hea Qumay is occe1d y
ang a lacp by wthich a Vaniable
CL Ae inde num be of lue
aub le ntialiied to G al aroay- Jhe hdes Lhi-
nd 9 i in CHcmenlod to beginnng o he ouo Joud.
Aan IRe Sie o Hay JoTken, ane leie
ha Re elemenB a[4], exam) le arta al
accegg hiene elomenG a[ej,'ol[, M[I.uecan
alue Slanls Om 0tougha Vamabke i we
and 90en upo 4. So
Single Stalement aiLI dieplate o in
difdual eln
mame oQnay: Jneach ilHalian
o q Loup Lfe value
inciemented and next element of auna4
a Cceed
agHam
ndu de <stcdio-h >
include AConio-hz
laid man[)_
ink ar s1
inti
oisoiks,itt)
phiny n Enlex Oay elament)
Scanad"&aiy
pHinH\n dhe entexed Values ane: ";
ai=o, is5-itt)
pHin adanIi1,
getch

One dfmensian.al atHay


One
nee OMLAy us
he eaoh
delined
Can be lement o an
acceaged by
b AHay mama olloLu
Name tadoued
anNdex ndosed un ba ckelg. AU aMay elnenieg
iHe numhesed slathng
Jto O
Egint SISJ= o,20,30,ta,5So e 34

S10 to|So
Dute
Pory

2 wo dimengianal avtayID C-he tuo dirneno.


e do
aLayCan be def
an axHay aNaye Jhe e dinensinal attay
Otay
OHganized as hoatnices wRich Can JtCpHeAen
be
HotuereH Ra
Ltecfon o Howg and Columns
OHay9 QNC CHeaked to mblement a_Helaioml daln
baneloak ike_dala ginuctwte In 2d 0LOy ar
lement Can be cceseed Smbly by atay nar
allouedby tun index num6eHGenclosèd in. O¥acko 6Hackek,

eclaxaticD otuo dimensinal Aunay n b


h e Suntax o_declane 20 atiay is gIven belcn
data ybe attay-name LHaLuelLaumnsl
Examble -
n ttwadinen[uile
HeHe 4 i s JRe numben ol Houg and 3 is tRe num
ber o Cotumng
9nializatian_ o 20 atay o
-9n shgle alimensin
dHHa,we den't neca.
o shecidy Re z e oavnay dèclaaatim andand
nhialfzahian
OHe being olome Simulfaneauay Ha
eLen Ais_uilnat LUOHRuitA Ad aNMayS ue
Lull have to dene atlcast Re Secmd dhensia
aantay: Jhe 2d atay Can be deolased und
celhed as
ntaouita1-412,3}, 48,4} 139,s4,S
Dote
Pape

ExoLmple ua cdensional anea f


tndude <Gtdio- h
Eindude < lanio-h>
Void mainl)

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

Paseingan axHay_agpaamele to Junc hon B- we (,an


puss an
ehtieaHHaYas anaHgeumenE_aH potomef fo
uncfon hig Can he dane by using tun methiode
Pasgng aiou a9 0n aHugumenlLusing Subscifpl natahan
2Paxing aau_Ung bahler hotatim
Subgcxibt notaHon melRod -9n tRe SubsCHTpt
2netation mcitia
We ass the aay nane
uilß a Vamiable to hotd Re Size o JRe
along
auray Bath
0 em de u9ed as qclual barametersNhe Smilioa
dedana han dane tah onmal barameora IH
uncho
Mcitope nd unchiam delKI tioo, abain ol empty sqac
bMaces ollcuw fe mame of- tieaLay buk in tie
unchn coll, mly ie nam ohe auay and 9ize
eayMed-
LXarnble
ncude«stdio-b
ncdude<Camioh>
Voic ah )

int ants1,1;
l0t max (imHembaul1,blGit)
element in avay
piiny"\n Inpul
aH 0, i45;itt)

phin" Lole hee vae")


Scan "ocd " a LTT)
pMinHlo Jhu langest elmant aory p%d,mala ) .
is

gelch);
întmaxint tempauI, ihi Sie)

is0,isSizeitt)
tempau1iizm)

m stembari[i

Helnlm)

Shhingsn C-She stuing Can e deîned as


ane dimengimad axaychag ee
tenminaled by Mull\a Hhe chanactex a
GH GhHin9 o manipufate text guch P
wand 0H Sentencen ach_chaxacleH_hRe a
ccuhie_Me byte mmau Cund c t chaa
Date
Page
muat aluuays he 0 he
1eHmihoim chanacien
Jmbonlant in astHin9Sne L
91 Re mly way
deniy uAIHe Hio SEHhg enda
stin as chaHSI10Y,Hie wRen ue die Q
hhalhed ui null h memorychanackex S[ia L mblic1t

DeclaHatim-JheHe aHe fuo uauS


to detlane a
gkuingn anguage-
9By_chan aHHay
2BygBHng ileral
Examble
chan ch[1=4ga2
ue knomu hat anxayndex a'sh' 'aL Ao
Lunli be Jie bOaenled as 9kauts Yuam O90 9
2
3 45 8

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

JHaveoing Shting -Uhavesing the ghing us Gne


thie modt mpontant anper
Cunpec
n any qHoqamnung danguage We ynaymay need
need
manutak a VCMy lançe text uRich Can be deme
taMsanaing ife tèxt Inoversing Shang ds
Someuri
Scmeui
dilferent piom aersingan 9nleger aNay lue nee
to kouIRa
length axraH h_rauerse an nle
tray uhesean lue may Uhe tAe null choasacke i
Case shnhg lo idenhy e end Re sixng and
fermin ole Ie loup
here aHe huo ways o traveHge à ghng
By ing He lenglR of ahng
Byuing Re nulí choácles.
getsl) Juncien-fhe gets0 Junctio enable d
Uec to enle Some chanocke
otowed by e enle Rey- UU h e chaàacth
-

ed by ueer qel Stoned in chada ckes_ALay e


ge allou ie Ueex toenler the space shauak
Siing
Deckrahicnf- Chail I gels{char1)

Readhg Stoing ing Seks()


nclude4.sldioha
Date.-
Poge
Laid man_

chansI3a7
pMnHEnley Re giamg "):
geu(s
pnnt|"yauw enkeaedJsYs

c Puksunchem -PaukllHunctim us ues muLh_Smuieu


N
to pHinH untim the putis) qunchm
ia used n_bHint Re gtHing_m
N
Re lons.ote_Luhich
AHeiaaiksls Head by Uamg gelsth_SCan unchoy
Puts unchmbHinks an addihonal neufne cha
acker uith gbiing uuhich aates Ae Cunao a tRe
neL ine m lomsete

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

SEulen(] LC stning kengR


he eBtlen) ucton_Hehne Re dengtß o

qiven StHing. 91 does nat Cmunt null Chcdactea


Synkax
d
-StHlenLaNNaY_aame
Examble vamable_nane
ndude <sBdio-h
Enclude shlng-h>
Void mahl1L-
chIa14s'h,u,b,'h,a','n\o1
lcharDHfnlengti o s t n g 19 /od,stulen{ch))
2Sncby() LCcopy 9bing
Jhe
Jhe Scby (desibolion Guuice)
SounCe sling irn dealna liom unclion Cope the
Kamble B-
Hincuce coldio hz Syntaa-
|Endude <gBing h Sncpyldehnuhoo, Juuate
Void moin )
cha chl2o] z i 's,'h, u,B, u,'A',i,^d}
chan chR[ao1
Shicy ch2,ch);
pnin C"Value of 9econd shing ie
lScha)
3 Sthcat()B-L c slning Concalenahim 1
h e sib1cat (instaming,
luua
Second-3 toing) Juncton (ant alenale
Sbting9 and
1GAuCt 1s tefwined lo
iust 9im1ng
Examble- nax6
#indude <gidio-h Scqt(as sahg-SeLmd th
+indude2gning-b
Void Thain)
cho chI101 'h','e', 'L','L, 'o', '\o't;
cho ch2[1o 'c \o;
Shcat (ch,che );
phnl "Vaue of inst shuhg is fosch);

Shcmb ) -[C combaNe SihgJ


ojhe mpHirst- snihg,9ecomd-slung) Junciay
bolh
0
Compae two Jiefuwins
ghting and ae
Stoihg9 e Cqual9n below exumble
we

ng9els{) Junchron uhfch neacds g toing acm ono


(O
Xamble
#ndude Shdio-h

include <stang-hz
Vand mah)1
cha stulea1:
pin[ Enten Stuing:")_
aets(stH;}|neadh Staing JAm mAode
phn("\n lower stufhq js J69"9iulwnlsba))

he Smupnlgttnq )uncfian ietunns shHinq chanactez


he
In upher Cae
Example
Enclude<Skdia-h>
indude sghthg-hz
Vaid mabl)4
Chou snl2o1;-
pHnEnlenshang:"
els (o);
painl( Staing is os"Skn
pain \n Upbet ataing is
as",Sup(stnl};

You might also like