0 ratings0% found this document useful (0 votes) 119 views32 pagesFiles C Language
Files is a part of C language,here is the notes for basic C learners
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here.
Available Formats
Download as PDF or read online on Scribd
UONIT-V
Tye, Destin: A type’ de¥rttfon! ° typedef” gfe o. nae
to a datatype by creating new type that Can then be wed
anuyednere Lype b pormitied:
Sephoa? typed} databype Tewnare 5
Ege typerety St Toteger j
ar tyetey foo’ reel; “es
TIntead OF declantation usitb esse000 got, like Unt a,b;
nop we con Code. Whe Totgen a,b3 i
Jin the Same way wsteod of leat, now foadirg pant
punbes Conte dedorud wing ‘rnall-
ccontaale ure Of bypeded-
Sg: A Cpeogrann xo det
$indtude < Stdio: n>
fat natn)
t
Epes yoo
seal 41,42 Pur;
Patt ( "Read tuo Yoating
econ ("961 4”, aft eho)
Sure = fF? 5 :
Pril{(“Sum of too Alodting ook curbed =f
selon 05
port nurobexs”) 5
Sure) 5
3
Structures &
a
' Defisk bon? A shructur
clervertS , POrtBy of} Aiyporst types
name: For exarnpe, iy we Coneden O “chudent”
ctudest Can hove a name Jor type sting) | a roll no let type
eB a collection of elated
but havieg a Sige
oa
1—————S—
puriber or thing) | reonks (of type ruraber) + But all the
chawactertsti cs beloms fo a Reoge Btudent- So, we Can
cuales o chadent structure — oitth specified chhanacteric hes
wor Folds a it A field othe Salk aleroert Of
data that hos rearing {ike rare , “soll 10 dor ckudent-
The diyjpunce between ah omay and a
%, trot all clernents in an amy mrt be oF
chuctwe ©
Sarve tye ,udbexe 0? elermerts oy chruckue can be
ASijeuct types”
Declating a clauctue 2
shructue
toe have two Woy +p" declasting
\ using Stuuct hayuod
Using teyerlef
i “he aes way OF Aeclasting ctructure © called
Logged chructure®
pout be dedaud and valto defined -
cleuclwe-
Syotars gbrock Adentifien
t
Sieids Vick 5
44
Caarepe + skwcet chudent
{
chon rare (20);
clan ADS};
Sat | pranks 5
x3: The Secord type OF declavatfon uiing ‘typeddey Uses
wo Meyer “typectey” Fox Gear: ,
Satta 8 tapecey ehauct
{
Beeoras U5
¥ ideckiffer
elarople & typedef ghruct
4
chat narce (2d) 5
chan Idd);
Bok rook 5
¥ student 5
aIritialfjation of ° Shuctine ¢
ni tialigation oF chutes axe Aiwtlan to amays
Valuer rout be emlesed oo wrote, § ond 3, Seperated by commons
Values, runt pecitch tHe conerperding types Fo Awe Structure
aefeition-
sritialiging > tanged shauckre &
hack ghucentt
a
clan name 0];
chan “AVA,
Sak! rrankS 5
yh
eat ctudent S\= *ppand”, EBON, POY 5
strock student sa-F pwina”, “CBiT-09"45
Ghee “Ae omy unini Haliyd — Values of} Skuctwar GURL &
pore null Values“rnitialigtrg a typdet Shruc kure g
typedef struck
{
chat naree 25];
chan ido);
sot roasks 5
Yskudent 5
a Sok foand” * eBT-01" 53};
» . 2
atudent So={* Avviod’, © carro];
chructue can be acuned Frdivide-
qos gna Structure We nx SO SEAT
yer we mut we shrackuse
yas name:
~ ably: Jo neq joa
ctruchoe 4 ‘Ye
ext , yollaodt by dot) , jollowed by
sia his
ey To ane rare field OF O akudert ehruetume , HE rou We
; Sara
we can read ord write dota to stvucture
ow oa Fel etme PES
Eq. To wad \alues t0 Ludert ghwclare
seated
beso’ elyuctore
ab os of
oo St ad, St rraskS )j
pacts abe A aes ora
eh c progrers to wead nar ,WIlro and reasks of
a skudet io 3 Subjects and atpay spe Sono o Alen
ust total and “overoge of marks uring a
ytoclude < stdio. b>struct — skudest
a
chan Id 00);
chan narre (19)
Spt ent por. FOB ur 5
“Float avg j
3
nt reatnc)
a
ghruct Student 5
PA ("Enter vollno of a skodent”) 5
Séanf (" 9s", ¢S-14)5 7
© Psth(" Ester ame of a student”) 5
scarf{" °fs", & Snore);
Pratt (" Eater craks of a ctuaest Sp 3 Gubjeds”) ;
Scamt(* “fod ort 08", SON, £S.10r, S13) 5
[Link] = S00) ASemr +S 093 5
SONA = s-Sure | 3-0 5
Path" Detail of student ove :\9 name clo
xol\ ro: s\n roaxks 10 Subject: YAN
ranks 30 Subject2* Yod Wo masks 9
subpcta: dln Sure ofcthe reaxks cHtctined
by student + fdio avero-2P of the masts
obtained by ¢ student 150, Sename ,
gata, Serot, S024 1P3, $. Sure S-0%8)5
j elu 0}
4, Mexted Shuctoouss
We can have Abriucbeows war-membsu o}
Gructuxe. when va Aractene Lnelerder sassitier Atructw
: 3ek & called a nati thuckoe foe & ad
he ro: OF ehuchiue frat can be nalid- no Kinet fpr
a For enarple, we cwake a Plsubties Cale)
claw” whee rrernbes oj Ulan vere a Abvucture Fp"
qouu! ard a Btauckwre qo Audet Now, don &
con wuld nue qpcutty ard Gkudant cove Stractwres
nosted in 0 shuctue Cars
Declaring Nested Stauchuse ¢
boben we declare nested Cho
decloxe “Ke Ennos roost Aracdwe at , feo the ne
ard ko eats codes most ebyuctwae? In “the above.
example, Wwe rowst declare cally and Student MMauckwes
zat ard “fun The rot uel Abra lax, bos to be
ecw, we recast
at (evel
declaud-
Avact acuity
t
chan nanne [18];
choy Aubject 15} 5
hast Facuttyid Cro) 5
45
thract gtadent
t
char dic};
chay narce (16) 5
int Foy) PH2,193 5Ghuct Focustiy fs
ghwuet Gudert Ss;
43
anttialigation of Nested hate 2
Each Stvuctwe roust be gattialiyed
ve protein to the nat mercber- Each
torapetsl'y befp
entleed fo Jet bias.
Aruclwe &
ey thuct daw c= i Anand”, “Mathematics , “Statf-o1"§
{'bit-o", * Auvind", 502% Fol 4;
roarcbes pure Neded shuhaw:
ba
7!
Fo acces merobers of a nwlid ahructwe ,
we fnlude ead hwel por the Viglust Aawel to the
Cocoponeat being reyererted: : :
Gye To neh to name of -facutty we muh cuct ef ame ‘
town. Fatedly.
thud dow C, ehauct frosty Ff, thact tudest
cd: name
4d of facutty ¢ cof. Feleutty 4
Qubjert of Faacuky * co Fe Qubject
of Guderk & C-S: name
al 10 OF Chadent asitd
moosiks “eh cadens, CSN) Gseou yess
5. Avay of Stwtexn’ Th owe Ca¥, ewe nud tovuale
0 O50 oF chutlwe. Fer exarople, oe ke OLB ee
4eudents, to dove thats Enjoweation fie. RAPER
huded dructwes-
eg: glauct — dludert [60] j
gr Cpmgiem to ead ‘ard diay “fe delatle oy Sudof
» a Chow using aony Cauclwes-
$renclude « ctdio. b>
avact student
{
chan are (10);
cox Od (1035
Ent nak (6) 5
ystsh5
Snt reain)
f
got 15
Prat (" enter “he details oh
Bh qeas acest aD
ip thudes’) i;
t prints("erkoy name srilre, peaks in 6 Sax
of Sutest cot a", 2413
StanS("%s ys", stienowe , stis-id);
or (5x0; 3x0; 1+) :
Seant(" LA", golis- rote (35) 5
iy
pritt(" Details of “te Aluderts vas entoed vasxdh)s
Hol i20F eopiat)
iH ‘ ’
printt (Shucerttd 2 alt Ystt, &4, SUI name,
sti}. id),toy (Jeoss< 659 FD)
3 pants ("feck h”, SCT +manks (II) j
yekuw 05
3
g. Glauckious and Funchions ¢
=
We can
Called qunckion- A qunckoo can acco the rrembes of A
_ eyidual tan be posed 4p tte function.
Eg cpg? to read detotb of a Chudent ard calling a
qanction to diglay the detotls thot axe powsed oe ep dtvidaual
rere Fao & thruclwe-
yendlude < ctdfo+ h>
deve kudert
{
chat naree [15];
char yetlro(is)>
33
wt
void ctixplay (chor (3, cbetl3) 5
Sok roan ©)
Z ekiad Gadent $j
print ("erty rare Gmail ro of a Rhudent")§
Scant ("6S %S", $name, gallo) 5display (smare , Sexollno )}
rekinn 05
wid display (chor Sname[ J, chan Syolln0 [ 3)
pislf( Name of te Caden #%Ls\p rll 90
of tte tudents s\n", Srame, Saino);
j ycluw 3 i
a A Cpagarn to vead the detat of a gtucent ard |
calla qunetion 40 ciglay the cltath tat vee poosed by
Rust tere dhuclwee-
tp enclude x etdio. h>
Chol — stadert
{
char nae [1c};
chan vol8ro [is}5
35
void aisplay ( Shuet Cudert) ;
nt rain O
: ahack Cadet $5
Pasnti(" enter fe cetath o 4 thedert )f
Qeart(*%S Ys”, Snare , Serallo) 5
diplay (s)5
yetoin 0 iVvord Aiplay ( thud Cluclont tu)
t
print" Detail of the Chudent aves") ;
parté(" Jelt the", Stename) gtu wlio);
h veluw ;
zy gilex to Shuclwur §
eS
Cruckuse caleo Lon be catcowed — “fren
eaten, After! declasting The Gruclwe, tke bow we dai
wo variate of ruins ge , te Some ual we con dec
piston of Suche type: "|
Qtruct — dudent yeu .
to addxox olf
ard Wu porns veritable can be cousignd
hat thiuclwe bype-
variable Of
eho student S) |
abot Student pies
ptr RS}
Jo aces “te values ot ghructwe mnenbor unteg pointes,
we hae {00 relations:
(e pt) « Seldmane (Co aad > Feeldraree
Ege (ep): Dare (x) pls name
Eh coprogiere 4o sicad vand display the delatl of @
udert urea pordley 4p a Shruchwu-
$Encude x dio: h>
Geruct Stadent
tChay name (15J 5
chy — ollro (ic) 5
Int rol r2,m3 5
elsuct student $5
gruel ctudert* pes
ply = 45;
paat$(" erly delat ch o ctudert”)3
Stans" s "hs Ldditd” aSePome Servo,
Asin, £5702, 45-3)
paalt(” parking the detail op + Shadant wt
Peed yorker to student thuctux s");
pant afc TAR a LALLA, (pb)e Pare
(xpts)-aellro, ply —> 1, pam,
pir roa);
yeclunn O05
3
Usiow2 A win ba Shruclue all of Lohete member
Uae “He Saree Choriage- “She areourt Of chnage allocated
tp a usioo B Aufided ty bold Cub Larigest mmermbe At any
un iene , Orly one reerrber of “he uwton tray actually
swede in that storage: A Uric & declared vst va
kapoor ‘union’ « Even thing including ke Syolones Contep
axe farce fos bath owen and shuctow , 21 aft the.Keyceort Struct recat be veplacedk usith union:
eg A C- pagiare Xm swad and Afsplay he oletails 42
Atudent wing Union
Atnclude « tdio. b>
nino gkudent
4
)
chon name {15};
Chay nellnolis}5
int — rearks)
pt matt)
e
s
union Student 95
pal(* erkes dabei of chocent “)3
Scant” Pigs" ; «nore \
Pratt ("Narne of Oo dudert & 4 ea [Link]) 5°
Park (“anki pollo of O ehudent”)5
scant ("%S", <, wil) 5
Pad ("Now Rol oo Of dudert & 8) grind
Panth("xead reat Of a thudad");
ecart(* ha", 4 enc) j
Packi(” patks obtained by Ns
elu 0%
adunt s§hd®, S786)
Dr Fican cs Between Shraclwws ond Union &
eee te a ee eee
ehwuctwe Orion
yoke Kegward® Struct” & wyd to \- the heypuond * Union” & wed
define a chructune id define on UNTRY.Rulchen a Vesdable caxndaled usio,
a Awthwe , te compiler aioentes
Ake rrercouy “yor each mercer the
Gy gq re eouclwe greatertan
equal to fe Gur of SO OF
bb reortbes.
[Link] reercter uiffhin vo suche
Bw
Lacativo
yg. Attodt qe raumbes
he Value
will tt thes mrerobes Of she,
cooneged unique Senay ore Of
2. When a Vasable “e oxsorfabed
Lil a uncon, the cornpiles allecats
Se gy the Lorget reeneore
Hie
to the
3M
by Sodk vidual members of
unto.
G Moding the values of AY
veil alter ihe arco |
member
values -
Shuclew -
5. Srdfvicual rambo Can be cnconed 5-Ooky one. rember Cn be
at a Aire: catcened ok tine.
6, feverial mrambes Gy Arutlwe [00] 6 only he. yor rurber gy
Sratially wt one. een Con be juitialiyd-
Enuroertatid “Types
bad on the Aan dard infor
each inte value ven an
* ener eration constant”.
Declwiation of crurponted
ah identifier ard th vokus-
Syptos! enum typename { idaskifen
he erurvialid type bo wer
- On an ete
denier 2 iw
Fo decloe 00 emurmesjaked type, we ret declare.
Lat 5edum — keyworct tr" enumesialed “tye Joclooatis
pose rete ot ura to wandgo war tye.
tdonktjer Bat Ext q Values to be vallewed +" Cpeciffed tye
Each Tdenkiier ‘uo the tak 6 caustgned to an
Eoteger value 5 we dorot euplidtty wong the Values,
she Compiley voustqns ste iia idestificn he Value 0’ , Second
tdonfijfer to Y wand Joo, untél alt op the ‘dantifier have
0 Value.
Be ener
jhe toler’ type bas only 4 Ualucs «
Age declaring von enuneralid Spe,
coor { xed, blue, green, while J
Range 4) Valus ae foo
we Can Cuake unsdables of
Ext crus Coley procticler;
gpration gn Cramexatel Gp
AN opsations alegined jo" Fotiges can be Ural
wtih enumeraled fy We Cap add, Subtract, multi phy ancl
divide eourertatid ype: We Can paws fham to Ctardand ard alr,
applicalion quection-
Fo assign valua to enurvesiated tapes
erum toler X5
erum = tole 5
eoum cole) 45,
x= Bluc 5
ye Rid;
~~”
adsTo compare enumerated tyes :
4 (x==y) © aye bay)
TetMaltfog Erameialid Covtantss d
ee We can aatialige ow) values 10 ‘identifiers. Sp we dont
Spdty ANY vake, connpiley aurtemmatically os asst ieg re Vole
sor O°
eg: ener rents f gan, eb, Hao, A Hay, an, Tel, Aug, Sep, oct Now ec}
As we dias t Specty any idalvalua, defoultly Jor will have ©,
feb ul have tard Bo oo dece call ave Wh
gpa wart to stant fern |, rave to explicitely rrention &.
oolhs {Jane jgby . dec} 5
enuro 1
gy we wort to ghe Dw ow Aet of Valuer Eocluling dhepicmbin
we con asiecly wausigo « j
eronees ross} Jana, ferry Vosts | Apr" iy
Tnpt [ ost pt cpesations 2 :
token we saad Or enuroeraled Type, UF
rout wad “ck Ot DD infogey poli We dirplay cmeyer
dated
ding fokager wate us) be pe
ep ene roofs psone poston Ne nya ha Me
enue reowhs moonlh 5
to wad?
= geant(" fd of, Arve erent) ! cayet \to Daly
wb PEE ngatt (Po ha fe, roost, roma) 5 P pind Veo 2opt_ard Oubpet -
sali 22 FE
ea
fA ile 6 can entinral cetliction of sutated
dota treated 0% O unit Since Ahe Contents ob praia
rmernony aoe Lest shen “the computer bal dew, Wwe
nud qs te store owi data porierareitly One mooie e100
jhe Collection OF data v often tro Loorp to swiide enlisely
PALL MMLCTG + *
Files ee toad 0 Secondary mney. Test
wed Aecondary meroony uri we dink and
Ewy opesiatirg Syslero Gar Oo At F sul 4? ramig
th its: weher we usant 4o wut oo FE; baud onthe
tubs of posticalars gperatirg System, poe roust Ware Hero:
A pogo pat raads 61 wots 4h,
nods to know SBuvwral pleco i fon ALK Name
oh the fe potction q tte crovert chwraci» Loa File
ard soon: C hm a prdtzined qhuclwe to hold Wh
ee oe “ek ten aye ye
Cyuetwe wid tdenteier "rine Hamed needutty, Lectant
ao fe of YP “PLE? qe" daclaxirg flato on poe
+ as |
ao a compli , din Us fnpat to end oulpet
Qheearo: A Chveore can ke coolialed with a
Ke keyboard cohen we 200d) oA ustth a
°
B,
°
2
porn
prgical doviee (LE
qe stored 0 uri Gooey renee.C hanguage we too type oh Chreams-
te Seat styearn and
2 Bioary Stream:
A tert Stream Commish of Aequente of charadiu
dita Gato kino ust each Like tewdinafed boy @ rusline (Wo)
A bi ghream Coma 4 4 Seqcane Of data value, Auch 0%
Lrhige, sual etc wsieg hig prereorty sapaesentation «
Shea TL pow &
A dle exis 08 van Sedaperdrt entity With
mame Hoon to Fe) oper Sytem To we % fi ee
Progam, we reurt vaxrotial: the pagrares shear Name
wih ae operating Aystew's ‘penne
Jo pous 4 fe ned te
Sinton, the streer
a fle» whieh OKO
cfata the Chyearn Narn with
ae chow the fe
Creaking a Sts cou :
we Guake 0 Baearn who we ducloxe ik-
he declaviation Wr8 jhe Fe bye which & struct
fueit Sao Contains “the Enjorechico nudsd pr mwadiig |wsiting-
eq Pex pe
po Be poerter to tte | Styearo-
opaicg 2 1 *
Att cualing oO ttyearo, ue nud to wasocfate he
gtream to a ‘file. UR We a Shardaid eoction re opening
a . Sle %
fie wluo o fie % opened, We FILE tye potter aqied with yee Enjornation- The oper qenction retums the
adda of the file type , Stored “phe + Thr qe open
quncticn creabs the Stream, which woe then 941 to by
name.
Feo Jung dat’ Oseg Ye Sheer Hames
Ayter ouaking A loan, we tan art the Sream
poco» io ntlfons whos Wwe nod to Occas fhe Conenpon-
_ating ae Enpal 6 euchpat:
closing the shaeam?
a wo fi, om clore the,
Aye Cornplitton ob cust
fee byeahs the ae 3b betwen the ‘filename
qi clstg
C Language doclores ord pines 2 ghyearm
Poedtoa to Adio The fist,“ Adio” posh tote Atarded
Eoputt xeor y Second, " gtdout” porns to the Moandard oxtpit
Cheare ard fubid, “elelers ” points fo “Pe starclardl envy
tlyeom: “Thue Steams ox oualed then he -PRgran
Chand word dled cot te and op te! PTO arictonactl cally.
aktandard (bye inp |oestpet Functions ¢
= —— a
ate Gatos” Weader ff cortain, Av
aSypecent inp | output qenction declanotion “They 0% poet
sunko aSigoust cate gris oe
ie Pele open [Use jerctions
a. Fownatled Sopat Joukpet
3+ chastachs Segutt lowkput qunciow
G: Ge frput | outp junction
wv
got ony5. Bletk Znput| out stgenclions -
6. Fee positioning gunctions
+ Syptiro qu opertattions ard
a. Fob Status qunction. :
sila, ope aad de quad? “topen ont Slow
ile open ope) *
Aa quncion Ahet propos <@ qe fe prounirg
bs Foperr ® open & tL, we red to Spectyy the plugfcal
florame and th rede:
Sutin’ oper ("flenaree” “roe
funame ts the Abang hel Juggs Canoe oy Ye qhepical
qe ue ove wag: Mode Abouss how we wl ure the fee:
nijfooal prods to wtith pin cor be opened Are:
WM oe ire
py file exblt, rekon pout sak beg
a chant enish, peter at
th w= tone roode.
oH adh, TE & esared 7
- of fie doon't exot, kB ve
it a- 4 nd .
d 5 sgideaintatip per Ie posttiond -ot end
a ti amt exist,
wy vt- xead and update roode.
ve wt - Ws and update rood.
Meat — agpendt and update roode
is uated=Car ia
Fle, clote (Felote) ¢
yohun we no Longe! nud wo fe use, Abould
lowe U-
Syphon? Flere ( jierame Be
Fertig Tapa outst Faneltom? Scant, Fccant, pret Apt
Tis uso qunctions Qrdnt dnd) SH gcant some. énpat
gue dxctebours LEE) 5
* control ang list”, addouslist);
th and dpintt oe output
ie ope
olen’ eran (” cortacl stg
Fccant ( atrearn potrtes
“The two cons pw
eee, e ”
yotms print (" corte Ching lt : penn -
Fo oan Cob poor)
Uscarn pine 44 -to- oto 0 the @hvoarns “that
how been decleoud word ayocalid usitth Leuk fe Syren.
ghrears pounle of
to vuole &
FILex Spb;
vale ont oy ont
control eben Gat wil
tded “0 control borg: oe
fot piel] fpr ;
(riod ase”
Pasiarcefen int Ta Faw whe Mk op cma of Te
variabls to which a Yana) Maa 1 eo tg Some te,
nant a} float bj Files Spb;
eget )- sean (*LALF ka, xb);
ar fscand ( spb “had” ga, 4b) 5
3. pil [" “fdit oy$” a,b) 5
Ge f print l Spty, 4 hd ft” 4 a,b)3
qunction: §
Chaxacts SS utp qerctios srrad one Chartacton
cat 0 time joe tent stowars, o wostie one chavtacley vot
firee to 0 tent sear: Hur sunction: “axe divided nto two
a 5
“Func on awodatid ust binimal dus
sa Function comotialid with often spnradral 0 Lett fle
‘ chaviacter Ho jection
Basal
City ter -tenvfoal flent fly
gercroriltiad) ——_putchar(lovb) ae patcpatc ungete
(read) (woke) (pustboach)
i weads 0 chandler -yeom the, Standard fopat Stream
Gyotan? ink gether ;
Putchere)? of write one chanackey to tu rronitten
tyetan sot patchor( chaviacker) 5
gete (or) A geteOs Fuse qurclfons stead a chastactey jyror We
ghears, which con be Stardond impit Shveam|terentral) 07
a wort-aipined stream (tent 2l)-
Syotas * Sink gate Cree Spt);
aint fgete (Files pt);te *
Putco ton Spste os Thue qunetion corte va chaviactiny to
ste Qream, whitch Can be a Klanclarid ouput Stream Hewroinad)
1 wo Www dyad yearn (tewt Stearn):
Gintast Enk pute ( chasiactin, FUE Fy) 5)
Sat Fput el chanadtir, FIE* ph) 5
charadvu into 0 steeann
tes 9t mods ore oO” Frome
wits to an Loputt Gyearo:
‘that bo ben opened fo" foputy U
Gynton int ungete ( chanackin , puex fp) 5
ie Top oat pectin
Ghandasid Enput | ok put janctions
a tot lam Ye) oe gets ge an
cron | gett (chore ps
chant sealer pe, Sok Abge, FUE* prey
Bae pub Chany ps
Sint pts ( cheers poo FLe® $pb) ;
which Heads
pas ep
wo Ate
plech Tegel Jubal Tuscan
fae jondker Fesead * yeads Spetsf ed no: Of
i qo a qe wand pee stern Sno rarsd7yy vot te
Gpeergeed Locatior:
Gptor® won frend (vordx py, jot elerantiép, int Count, FUE hp;
pe- peioter jo Se toput corre, ED) enorty
ehercert My and Count ore oust pliad to determine
now wouch data nud to be Asanjooud
St - qe potaten fe wth data will be Coplisworite € °
arms £0 od qpeebton uate ae eit neat St
Selon £ gat funite(voide phy Sok chmabte, Let Count, Fred 4p);
Fe qositfoning Fanelfow :
Fue potltorirg coco wou usefel ye
nandoroly pouting data to dik fle the fou foe
Porttfoning qeunclions ne ue Oe rewire, tel arel
h
1% Reusind urctine Bob tee fe potion Sarticater
4o fe begfuirg tue ler
Syetan? yord reusind( FILE* fp)
Ftell function repels ie Current ppittion op fe
le reo kot stelaterve to te begitrg of lee qe:
Suyslen® Long int Seen (rues Fp) 5
fceek qunction portions Hee ~ Lecalion
Srdicaton 10 * Apedyeed bife potion Te ven fe
Qystay * ek feek( Fux 4p, Leng age) wink vdhougpo)}
toe Fu pth» to + open
acct - Enteger spat Getter Re torch bye Hee
poretion WP teal a Ay ’
Loluneper - constant Value ured to peay te
eanking point op He Genk:
a can bes
O- ase & rearwed fro begining op tee fh
yo offect & mearund 40 Current poretion
2,
ae oftet & munud for end of fi (EOP)Syptero Fue opeiationt 2
A re qenctions opertarte a atte Wrstenta ile
dovtead 7 ye Conterd: Te qernctions ues groraking Systern
cath to peryenw th opoiatfons. :
Remove Foe. Me xtrmove sunckion rerreves 0% ‘otebss ar ele
eusteg sh eatviral name
Sapte & Ent — stereove (chaste flerame);
Rerarre Filet Te once junction “3
aha veuton qh Re aie: af
Suet Sink snare ( Chase olAFUenaree, chang ewftlename); ©
Create Kereporiarcys Tele? oe Lemp fhe qurction crrabi, oo reco
Leengorerey output qe:
yeh? _ Five tropfile OF
Fo vitae A temporary ye ;
Potrte- So,
puce TP)
Fgtv= trepyfhs
pik Malu. Funcktons ¢
aa Fu quretfens wad te handle fle Stakea
ous Feod Ltot end f 420, tenor (tot
gt t& wed 1? a to te Standard tyster
heados 4s: Heads, ile toslain detath oh sendtions cauret tape
wed wither “he ASonary- ,
depts Atndlude n ggurase”
ot o& und fpr rotti-fOee prograretigy Tle codes
gn he Apecigied qerame tan be Zntludd do sf, prograro
plies ot of ti Line Ho of
6 aut t Beng Se
flonan: ; ;
chast elise —-Liteuo ares
cpieves field
eg #lixc wo ‘egue’
changes “fee Conedt Line 42 to Jo and -Cwsut fe te egiee
Heevror: ot @ ured 427 recpotig evw% lay ETP
Syatort strercr = ever
oben 0 preprese?
sutpub Ho evevr rawsare ouroh abo tae Corepitahina.
Feprageos® Ot alloc Hee proparemes , Te -aubilihy
torn to do wilain tosla Atk
enwountes hb, 4
to Convey} to hetotacirg fhe | prograro enccutton-
sei tbo corctitional disteckive of He prepreeson.
at ha 00 enprension SH enoliinks tp, an, otger
FH execs “tte Male roent Aequente when emprension giv 0
siue wut -
Sgrhars? By & exprension>
Statement Aequente
trebv t t Bo tenditfonal directive oy
Yhould be qpioeed by =e douche: Tt oetti fe.
Ctotternent Acquarte hen expression Cpecsyred und HG
Ainecve evaluates ‘y oe
Qyntant FF Lp zznnprension >
Ctatenent seguen
fue pce tolich
srelse
Chaternent Se-quene
yeelif: when we have rove Then One terclitions to be
hea 1" quoter precostig, Hfien we wey un Te
tordifonal Aoeckve-
Syetan Shp Lenpresion >
Caterront Acquen!
yee
Areliy emprersion >
Ckalament tegen e
tebe
Cloderment AquenteHentift Tits dovelie Bund to sayunel od
Conditional dinective trip) spllowed by Skalernentt Acgquente
Syphon st Aexprension >
Chatarment Aeguonte
te else
XNtateront lequene
sendy
2m be conditional Ainjective whieh etecila oO
Bee
ed bs chiffnect
Qoternedt Aequerce ay fu reac ronance Speci
Sylar’ ey rragmnane.
Qtatarnent Sequerte
pend It
elptey’ at Ga, 20. corel one! daoective wlach era ccttey Oe
Mottersent Aacquarte Toe pracyonare peated 3 undifivd
Qyatinss sp ypaep mracnmre
etelurnont Gequene
Ayer ipA C-progam to Head content to a qe and ditglay
‘fie fame an reonites.
thindlude «ctdioe b>
{at roan)
L
pur tpt
chan -Filecortent [yor] , Frame fis] 9}
Bictt (" Read a Fenarce") 5
Scoot (%HS" , Hoare) 5
Fup = Fopen(trame Sus");
Fpats ( Filecertert , tpt) :
AFelose (FP) j
$piv= Fopen (frane,"¥);
$F[ Frame = = NOL
Prats (" cant oper ts Pe ” Srouwe)s
alae ‘
4 ustile ( (el = Fgetc (Graree))} = EOF)
pactd ("oc") oy
4
Bclose (FP) j
4 veluin 0;
a. A Cpapee fo Copy Ore iu Ry Racer ie
fyinclude « adi. h>
scat reokn ()
{FILE fpr, a46pb2 5
fot chs
chan Snare (ad) finarne2 (25) ;
Pratf(* Enter Source and destination -flerarees”)
scont ("¥s5 ys", Framet foarmer);
Sptri = fopen (Frome! mits
fpto = fopen oarne 2 is woe
se fp s=Nol UV fpr =- wat)
Pratt (" operation Can oot be gerporeed)j
aoe
£
che gete (Spi);
ubfle (ch |= EOF)
1 pote (Ce, pt) 5
ch = tet ph);
y +
close (pte) 5
Aclose pes
yelurn 95
Ef
a. A © program to suveue the contint of o ail oud
cove tt ‘ko andi} eke
4ySoelede < etdiro: n>
Long courk_chavackex (Flex ) 5,
Ack roan)
{i
Looe
n
Sit 45
Jong, count 3
choy Ch, ch 5
Fine pte, afpr 5
ah
Aptats = fopen (* iter tat aay
yen = open "4" “Di
count = Court— character (Ept¥)
$seck (tpl, 1b, 295
PatF("No: dh charectes te be coped 2 ‘hd \p’, Feel pw)5
ubile (count)
i ch Agete (pty De
Spuket ch, Ap) 5
Aceek(Fpo!, -2L, is
Count -- 5
s
$elose (Spt) 5
Fcloe ($ytv2) 9
xetam 95
count—charactes (FILE Do)
feng Lan;
Sseek (pty, “tt ys;
foo Lan = Feld (yp) 5
Qantt 5
wetum hoo ;5