Download as pdf
Download as pdf
You are on page 1of 60
FAcucty: SHrvl Konark Svszecr PPS Unt T- eh %f Studies Today's medern appluatione Need Complex date gtrucberes te J structure 40 Cottection of velated clata tame of Aeffeort clad ype Te uwefal fer opplicatinr Hot need alot’ move features Pon truse ‘pooveded by te premitive dole Gee: fr Aheudtore oxlerde the concert ¢ ovvog by aheng retarted Tnformabion of hoteragonses late types together under 2 single Umbrella « Ayactore ta boxteally 4 wer dy yelote d toyornetien even of dyjret ck pe Coltectten qfuveobles nurder a ingle rome, The vo yfesert cota type and Cath her a tame teat us used ts th, pbrucban « ’ a Collects? q date of Ao er lngtelly, velate fb tntag tha vaxcatles fat aseowed Yo and dan be oecemed Wong a hades oe oe ae Gupport toon ined dota Type Prat won Rfore ) tog ethan. A) bracket ts prables wahtn a Abractaae one f folet HO” A xtredure 2 declored rng Te kuynord bred followed by A . tinitane Kame» AM +e vonobla d the atrudaae ave declared werth fra Bhwitne A Bhudlve Type ta geoeolly decheod byte wing He * Putoweng Bytes * Abu Ahuct—nonie 4 datatppe var—vame? Clodqa type ver —norty Do not finger t= place o Lemteslon after-fne ce frartter f Alrucdases And aun'cons + romps if we d&aE © deyne a hritline Bar a pludowt , Hon ‘te welated @nformakon Probe bly would be > rell_number, nome, Cousrze - ord Peer. Thu shructure can be declared a4 Atak eludent £ mt v_ney, Char rome[T0]} Chas | Coume [30]! Peat fees * 4 Now the straclare har boame a wer fefined otetype . Each vor—name dectosad wiry a shuckire Blwuite . The Atwuttive Cestaratio, houever, dee rob altocale any Memes os Consume Rorege Apace FH just quiet a toreplate fred Gawage te the C Cormpiler hos Fla Atrudlare 2 lad ok &n mernony ond Gira detours of fee Member name. Similor te ang other dot type yeremoy & allocated for Hee chructire behen ve dectare » vartable in Arachre. Fos example, ie can degre avarable studed by welterg, Shruct xtudont Atad (7 7 Here, hut ttideat © a dela type ond stad) Ya vanabl, wher we dethve vanables of “fhe atruslare , Reparate mernory & allocated mx each vontable « Struclire Declarabtorn metic da eee A @ Togqet Atnittores _ “he sduclare dapeniteon th tag name i1 called tagged. Atruchse . The fergicms ute rane of He Ateuchore : ta Colled amonber of tha i meme Exormple : : t ‘oe Bhut shade § fut vino) f 4 bytes thar nameLao] ao byte thay coume Lavy! do bytes Feoat Leer’, 4 byes Ww Ae betes Here , Bladen u He tagnama « By dappnng Ha —_ Hwilixe, vomery wut net be oesewed fer ang of Re members. TR allocateh ia memory for +o chrudure me have te declare fhe varteble of ter sludure ar chown botow *, hud Atedet” Abd 1, Mud *% hogunt eS | Ly Jemnobed by. z Rermcolen , ) (Adbrudtert, vartab les Once he gdredae vanables are dettared , to Compiler altocts momen fee tee pchucise vonatly . So, 4e bytes are qesowed ec -fte Vanables a te rhuthre had! and Stadad . (8) whrudlure vortables _ “Tha Eaquton tor dyes the Alruchve along wath Atrudlive vartables Ajovoce. bvuet § Atruch-romng typed momber |! tyecd rromber & f ra Yviwa,. vas ’ ne Ahove Byntex 1 Fee variable u delaved at “He tome ot truce declaration, i bxarople } Abad abadorct : t tt Tne} ~ Cor name fa0y’” Cnr Cousre B01] | es, Gated, ghd dt Te 4Ris dedtawlion, we dectore two yarebes vcludt and gfud2 4 2 phuctave Ahedodt . Soy Y yor tote cleclore more fan ove mable of Fhe sbrcbere , Then Aeparcile He -vanables Laing Comm sen he declare vourtabla ff Po Rlastlurt , Zeparale momerty 4 2 I Sar odd Vortable . " ed let us see gome rove slructire cectarationt , bromple! 1 Declare agtrudere ts gtne “udesmatero about a pout “un Hho cootmate xqelern fbruet powd- § Sat HY 4 Examplo® : Declare a Abrachre ty shore cusboner informed 200 Bruch customer 5 ach omtiid 5 Char nane[201 7 Chas addvenf2oI ! , long, sont phone —nurm ° uy Gramps 8! Dectore a Atrwuture te Hhre dyermatien of 2 potent, dae trad dae ‘ nt cloug > . Rab meth) XM ant Year ) a4 Declare g chudure ts Aleve ‘uforrnatenn of & Ereample forttutar book Btud beok 4‘ Char tite [20] ) Char author fae) | ut pagers price | nt rot —Prabltcatcon 5 a Nc Exomple S : Dectare a Afruclore ts create an nvertory record Bleak % ventory 4 Chor ped name [ae] / float prece | And Atel § ve Bleudace Type and voreable declavateon of cx Afructire Can on phere Plocoment in Pha vedtof name af fs ehucdoe Ld not be fai arta’ be other teal or glebel dependug Code » Cave ghoutd be aber te enw a Btructire member Aho and the rome of Moreover , as Ktredore Name and tbs vontable names heutd alto be diyjerest - ’ 3) “Ty pede t Peclarot ions The dypedeg Cclerived frown type degentern) 1 repparmor ts Crests a roedole Type Mame Pecan exestiig Uae type “By Using Aypedled «no ness data & Created’, Tatheron alterncle name quer Jo a Knoun data type > . Th qewel ayrler of WG fee typedip Keyud 4S orl erable: Hoe. Gwen ar [test utteg—da hou-dota Lyre Note Hot — typed stataron dees ach occupy ong memory. # Ringly deyre a nw type + Per exanple tf we aye leypedeg tet ——Portes i Aypedeg sunt TwrtGee | s}een Tnreqgre ute new name of dee Type oh Te Declare favable Wing the newdata type name 7 pobcack Hoe vareable perme wUuth Hh. ned dot tape « be C doe nef} allow dertaratter f varabla ot He tems ¢ creabing a cleclared in an tndleperdact IwteGeR num=5 7 Aapede depinrteen. £0 variable mt be Blatemerd . Ishen we precede 2 R4truct sane Wetn the typedet Requord , Hun tre ghruct beomer a rewtype . Zr awed te ra tette Conhect Shovker with Trase,- manning fal names for tyres alvendy defined by Co for types Hoot gou have decbrod . 7 typedef. decloratecties Pgnoryn for toe type For example, eevtta tyredeg Brad Aduclent Gt ono i Char name Caey ; Chor Course Ca07; float Pos , ' Now you have preceded fio Atracbae 8 rome Wh the Pel tapeded - tee Audet becomes a nen data ‘tyre + Therefore, nov) tyou can Ahacghtaray declare Vortable ef tr ness datelype as dou cleetare vareabla of type tot, oat - char, buble, eke, to dectare a variable deve sfadent You erelt jusb erste , Atudenb shut) 2 Nebe nat 0 have nob matlen atucf xtudeat tebe crerceligation af shedert + ghruchre can be tnitealiged in fis Lame bay O other lata tye we triteelged. Thetzaliging a stiudare means anigrivg Some constants to ha members qs whuttare. lehen tuo wer Poe not exphee tly iwidealze fe ahudare ten C autmabtcally does chad. Fox enh and =Ploot remberg the voluy ore witrahzed to O and charand xbeonge semberA ave Rnetialined to \ 0? by de foult. “The tmitealgers are enclored % braces and are Separated vy commas + Homewr, Gave must~he taken to 2ee tat the tnnallger® match new arverpending tygo in thee sfrittanee dagiw to : Kyoto Biuct — ahruh nore § data tip < member namely late =type merabver— name 2} data type camber —roret a atch = Seman et ot , Bhar Abst nore 4 datatyre prarhernome | 7 clala tyre namber nam 2 Wp BY, an ghudt nant Ahuchver= Seeeatet Conte Excample* Sbreet thud out 8 ink retl_no) Char nome[3] > Char Course £ 201) fioot fees: J atdt = for,tonvat, "BEN , $5000 4 Tt an exer fo anziqn @ ehuckire of one type to @ gtrubere 4 conn ho ape Precenteg He mentors af shudtve PR Bhucbre member voroble gormelly accened by wing a ©. 9 Cet) operator . The ryptox 4 accening 0 trateere of a Mmerber fo pluckirc Con be guen a! Shruck_yar. member rane a The dot cprcte sured te gelech # Partecalay member af FAs. tliodise + For example, Jo antgn vole to tte indrutdea) Asta morbers 3] te chudkee vorable tld |, se reoug rontle t Bled [.vetl_no= Ol > B Atedl. nome = “Shiva, . Khudl. cources “EEN Bra. Peas = 500007 To rinput vole for fhe date manherty te ray vnche aeomp ("Sod , Lahdl. vol—ne ) 7 acong lps", figted (nome), To peut vols of fea dotx paambors , one mag vt prof Cyd, ptedi voll-ne) / : Pree $C a", Atad (name) 7 . i PRegeammtnG, Exam PIES D write a program wing al ruclares “fe read avd duplay He information about o gtedent SMinctude catdto-h > maine > 8 Ahuct shudent * fut vel no > Char names 7 foot fees s Chay pob[aol > fl me Chas ryn_nolas]! % hut afodeb ghud ls prutf(" Euler Fhe roll number") Reanp Cwmd Ba hell xet0) / pet £ Ch PKta “fhe name \ nt)’, Bean f (Zs F ghud | nome)”, prot (wErter Hee fee \n") / heron l\%P", LG HAA |. Pes) 5 i pried (1 Prter fis Bale Biuth\ av)? i gong (ha Btudl. dow) | print pC" Enter Fhe SRN number\ne) ) Boonf("%os'' , Ahad |-2m—no)", prot fl" se RIE StTupENTIS PE TATU SKN") 7 Prot PO Poll nomber = %d\n''y Khe I-vllno) | prt (Stade name = Yos\ni', Studl nome’) 7, Prute('fea—%g\nit , Bhedl. Pes) / wtp re ai Dati f orth=%s\o", Stud! Dow) ” printf. SRN numbas %e\n" | bhud &n—no) | { © vote _aprognam ining & fue se fracheer te find He loxget of three Hivdade catdcoh> maint) § shock nwrebert . / ‘ eat arbi) a Rat Largest 5 us / hack nerbora rum 4 pate Enter tte Haw eared) Stand (“tod thd thd W Xrrum-a + Lraom b, rum c); $num. aS nurn-b LL num.as num -C d ura Lang t = num 2% Che 48 Crura-b > numa LK muro sb> nurs C) num largest = num «b |, ebe nur target = num. C! print ¢C* Largot fe nuumbou = Sd \n" , porn. longest’) ¢ ® wate 9 _pregpor wing druilewes te serd, coply, add, ssbhone and amnutlply too Complex Nurs bey Hinctudecatdio. h> rained) q ghuct Coreplex 4 eat ved, tink tenag’, Gat ) C9, %um—c ,fub—c, multe ¢ PrnkpC” Enter irs comple nuraber\ nt); Beongl'%od Yod" , Ket. veal, Lea .tmag)) prnkp 0" Enler xecord complex Member" i; Aoan pl Fed Yo" , Aca. seal Xea.venag) ; prnts CY Fort comple crumber = %dt%di\o" , Cliveal, C1 -teag) pant$ (Second complosounber= Zed + Yedi\0" CA weal, Catemag) ’ Zurn C.veal = Cl.veoltcd.real i Burn. crep0g = Clatreagt 68. 20g y Priat pC! Seeen of tooo comples numbers = Yodt Yedi\o", Sonc.rea| , Bum—C-tmag’) Kub_¢. veal c Cleveal—Ca-Ceod * Aubac mags Clatwnag —CQ. tag’, =Yodt%d'i\n", PoinkPC" Subbockion a too coreples ushers = Bub_c. veal, Zeb—c- rena) * woult_c.real= C1eal *%c2-5eel — Cc} srnag 6 a-tmeg’ Truk —Ctmag= Cletenag C4720) + Chiveal x CB tag * 2 Poiwte Cn Muttiplicateon of feo Complor num bere = Yd t%di\n"/ mutt ¢. eal , mutt c-tmag) ' j BD wrette a progam te enter two pore and thon caleatote He d utance hetnesn Han? uring shudares FF vncludocetdio-h > tmetudecmath hd” ‘east matnt) s Bhruct porn $ ; ant oxy S Oe Zhu potent pl, Pay 1 Float dutarce > prent-p Co Enter fe coordinate, gf fee Pork poent \ne) 7 stomp ("%ed Yd", BI-x, pig); L praat£(" Enter the coordunates f Ha Becend pont ni") 5: Reonpl'"Yad Yd « ,&p2-X) pry), dlutance = gayrt Cpowl cpl. x - p2+%?/ at pon C Cpley-P2 4, AIDS PonEPC'Dutana behweon P) and P2 =%P\n'\,dutanw)" sere vole a progrers usieng atreschaces te read ; duplog and odd tise dutances deimclade catdioch> — smarnc) § Abuct dudance 5 ant kms int meb¥ess adi,da,add_d $ prente Cv Boater Beret Datence\ nD 7 zeang C\%ed Yod" Raters , &d |+ metres uM porate C' Enter Second Distance\n" Soangl'%d Yod'", Lda.kina, &dd.metver ) * printe C" Pit Detlance= Zod kms %d metres\o", dieleme ,dl. metres) > print PC" Secend Dirtance = Yod kms Zod metres\n ) asioms , da-metres) 7 Odd _d.kma=d).tematda-leme % add —d. metre=dl.metres +d aemetrer* tp Cadd —d. metres > 21000? add—d. metres =odd —d.metres— 1000 % Add-d. kmgt t) pointe C' Sum ef Hoo datarce=%d kr Yd net \n'!, add—d.kme,add—demetrer) } Nestep Crevcrvges MENTED DES A Aluithive tan be placed within onotmer Structure , 4. e-) a Btrbure cmoy conta) amether etucure as ths member. A. structure dof amberns another gteudle os ite member ux called a meted etudqre declaration , tt not yeco: dectere thuctora, Zepartely ond Hoo grop He iz ‘J a when gorse try , Fake care to cheek Met Nesteng om Bul C from re tnnermort Ahuckire, Hen the neck feve | adruchare , working fowards Aurough th por ete te decare q nested atraidure bith ove romended. ~The easier and clearer pay us +0 mtn a high level ctresehre at be dene From trade towet- [evel fo the most tnclatve level) te-7 to tay, declan ee cuterCmast matusive) 2 trectoee . z Ayntesr. > * NT eteaet — ghactore| § datatype member! > datalgpe mombera? ghud Abruckare 2 otalstype rember! } datelype member) : uy : Ahuclk —etrucbured member_nove ¢ y We can abo we anofir raathod of eotartng woited shruthere . Moveinwen programmers make we 4 methed & thtwh uw tony for ha ond wer te urderaland ie datatape member!” datatype member 3 ' 4, but thuclure J ; datalane monber |" datatype mombera * struck etruchre! ranbernname $ 4, Ecvomple » i Date 4 Goth contatna Howe ‘eypornadon ~ clavg « rents and year, Ne fay brake we of puted gfrutbure tn ovder te cece the rrombers day , month Od year of te phutbee DOL. : Atuc DOB : fant doy » 4nd- month > ant year ) 4 ghuct Abodent eat goll_no? chor name [i001 toot feed | 4 fre. Dow dole ¢ waite a progwra te duploy Hu fafermatten 4 arane oy nidted Blrvelave “ aT Hftndudecetdiosh > matnt) Buch NAME 5 char fiat name Lae] Char — mid—nameLao] > Chos — latk_narne[ 801 7 \; / — Atwe DOB i sath 4 ont day; Ant month * ant year Uy Bhuct stadent j ; fat roll_no} Shut Name name 5 : Pivot Pees 4 M ghd Dow dale » : 4) Atruct gtudent atud! % PYELPC' Enter the voll number\n)) Beangl"\%d" , Retudi eyo)! print pC"! Enter ae NANE\ 0") 5 tiname , Beonel" %ox Yor ok 1 fated name fare A ghud|. nome «rnid— rane , Blad |. nore Lenkeaa pets (“Enter the Peer\n")! Rang l" %P V, Xetedl.feerd’, print! Enter He DoB\ nD! Keand("\%d Yed%od A atudl-date day, Lefad! date «marth , Aestedt. date. year) » pant pC Sropen t's DETATLC\ ni) ¢ protg('! Rott numbor= %d\n", Zhud (voll no) + PrntPCINPMES %e oe %E\NN, Stud! nome. Pert name , shad. name arotd—rone , thedt nant. lahanorag!! poole (OFEES= %P\ nll tad! Peet) > printeC\\ Dak df Bixth = %d - Yd ~Yed \ n't, Rhud! -date.day, Afudi. date. month Ktud dete. gear) > Prevagys of Structures 5Tn a claw, we do not have jut one stedort , bat there may be Heat bo students, So, the gome definttion of He gtruclure can be ued for all the Go Ahudents. Thu would be powerble than we rake an assay of Ro Atuchare , ater’ Adruct ctruchname ‘ § Aatetype member rane! > datatype — member_none2? 4; ft atruc ghuch_nane struck var Pxize L Exorople: Abuck —gludont- fint roll_noy Chay nareCasy > Char courre( ae) > fat fees’, 4, A khadent array can he declared kimply by writing, Stuck gtudent Sted P60] + Now, bo axsign Valun to the 14" ehedent of the Clon, we ioill verde, Xtud (tT. roll nd = 09) Bud Ci Jeane = VSDVAN! Biud Ci] comme = "BEM 1 kad Cid - fees = So000 | . Write a ‘Pregeam ing etruckires to tead and duploy the tformabicn . ail Ho abederttr an. the Claws i Htncludecatdiorh> maine) Rpuck Atudent “ § tat voll_no”, Char name C30)? Char coupe C207 5 Char DoBLAOI ) ant fees! by Ate student Stud C607 Q ant on, ts PrinteC" Enter the number 4 studenten 4) > Bong" Gd, &nd > forlizop tens TH) 4 pamnt se Ct Entor the voll nuraber\n"') » Beant" %di, RetudCi I -vollno) > Prente C' Enter te student nomo\nu) } Reng" Ba", Clad C4]. name) | Print Cl Enter the eourke \n" y Keangl"%R", alud [i] .course V ‘puntP (“Enter Hye Dote of Birth\ n° Leant ("%x"", RtodL[zI + DB); Print.p CH EnCar the feeXnn)’ Beane l Ya", Letudlid. Peer’) 27 y for (i= 0 ten itt) ‘ prnteC" Detarle Gf Stedent %d\0", THY Prot PC" Roll number= %d \n" -xted Lt J.xoll_no)* Pant eC" student nome=%a\n"l, Ard Li Jonome)’ Prnte C'Courge =%oa\nt, Rtad Le], Couree v Prtate C"Do—% «\ ni, &tud £2]. DOB); Pritt (Fees =e d\ nil, StedliJ. fees) > oy UNEON.S Claritas te shure, , a unto Ue a collection Y Varcables fayfoort Calatipe . The only dippererce between a Atructare @rd a union ts tat en que uniont , you Gan arly stove tn gormation tn one field at any ont teme oh belter unerstond a unten think of th as a chunk of memerg frat B wed ty Aleve vortable of T4feent type - shen a Pew value 1A Clisigned to @ field, she exicting data “4 repleed weth he new data. Thus uneons ore wed £0 Bove roemorg They ore we ful for oppheateons thatenvolve rnuttip lo gmembers, ishere values Teed met be aunigned te all Ho members ot any om time Deprortreon *, Unton & ao Apetal data ype awoilable d oP INE that allows 40 ey front dala Dectoreng a unten: ypu tn ts Zanu memory fowtion,, “The ayntox efor declaring a union & Phe Zame cs that! of debeteng. a afrucre , The only differences U4 that Inshead of wing Fhe keyword bud , He Koy wood union would be wed Bunker : ‘Unton unten_horme datatype rmernber_rams> 1 Cata_Ujpe member—rame 5 a, “fhe most mportant -fhtng fo semesber about a unten 4 feat he gige of aunren te the Rise of the largest Field “thu v because @ Sufficzent number of bytes amut be peserved te Alore fe lager sged field Examph? consider a unten xtudent wed fo Store Hu Khuda detots union a2tudent~ § ant wol-no!, Chay name fico > Ant fears, 4 char Dog Paods S L_unton Atudont K tad! 7% . Aeconng a member of 2 snsen. A member of % umen can be accemed wiry fag Lame gyntar os that of 2 Admire . To cece the fietas of aunien , “UK the det operatore . ) tie the uncon voreabls name Pallaned by the dot eperntor oUo nied by He member Marne , raging Uorone A Bhitkimg difference belsaen 0 strudare and o unton that an Gre aa union, tre fielda gharethe tame memory BP ace. Ao freh deta vephces ang exiating dat Th cose of unions nihgule arg fonitzalizing a value for “He membes of & vareable of union re, gout fritealige separately not tm a Aingle atatemert, at any enibant onlg ene member can wnttalized , Tt us an ervsfo tnitialye ang other union tember except tre fost Fnember , rite a progrom wing ufitons te wead ard dérplay Fro bapormation about~ - ¢ a Bhadent union Ztudent” tnt all_noy hor nameLlooy), fee! 4 , bon fac], g 7 union nt tad |) PrinteC Entek Ha namo\n') 5 Aeon (" %x NS, Bhad | Naru’) 7 DY rvite o prograrn ting oie? to wad and duptouy Me Ufermedie about O Atuden aor_rvrr* Ainehde ce tdto-h > maint) $ ‘Uneen gtadent” txt voll_noy chay narulto1; frat fess | Char pos fae) / uw Union gtadant gtudl * , prinke(' Enter He soll nurbean") | Beangl" Yd" , kttadl .xotl_no) 4 PratpCe Roll number=%d \n'", & tad (.z0ll-0)! Prince ("Ents tte name \n"") ; , Bean $l %x", Stud |. marae) > Print C" Nome=%x\N", Bhad (name) * print EC" Enter the feex\n'')/ Beane (Yop, ABtud!. feet) ; Print PC Fees Jop\n NW atadt. fees)" prnt£C' Enter tte Dale ef Bixth\n")} ELC MA", Bell. DOB); PRNEC' Dole of Bisth= %A\n", Atud!. DOB) ° . j 4 bor i ) Ue a Pr0g%arm Ching untent US read a pert and. deplay Hho coordinates Htrctudecetdio h> Tent) f Unien point § ant x) toh y 2 aw a Un'cen point pl * Pointer Entia He X @-ordinate\n"); Kaongl"%d ", Sple0d; Paint Cl t-co-ordtnati = od \n", P)X 0 printe("Entir Hey co-crdina’\n"'); Bean ("Yod ", £ ple yds printf l"'y tw-ordinati = %d\n"", Pleg)) j 5) write a peogfian ws tentens to deiplay tho total mem Aige Occupied Hineudecatdto.h> Beare Tagine) uncon studedt Ink wll_no;, char nome[50] ; Prt fees : Ua 006 L907; Fated: » 1 Print PC" Memory oceupied by the raombers afunconz Yod\o" , : ‘d uy Alger Catud 7) ) *, 1 j ( n tose of zhudure amount GY memory Sequned Br Atratline varabla u 1 Buea 4 mamory occupied by all member, &n Unions amount of memory reppie Store a tinton variable ty fo memo: seqursed for larged-member an eon. All tho members of Rl reeks can be accened at ang tire Bat, only L Member 7 a unten con be accened ata time 2n caye ¢ unten ang her memberx will Contain gaxbage value . Depfererces botwean £tuclares and Unions Structures Unions keyword “Ahuet? deqines ot ghruchere Exorap Bhudb £ badent ant roll_noy Chay nameLro] ) Chor Dowfacd > Jatediy 7 Sige of ghuvture U1 He Burn 230 memes all menbers 1 Bhe oF mmese rember 4 @ Bhruckne Can be tnittolied at once "AM He mombe re 4 Atruchere an be oecarsed abang ferme * Each member within a Abudere a asigned Orique Aloraparce of locaton t Altering, the value of a Member Will not affect other mernbere 4 phe. Rhrutore + Only one merber can be accened * Keyword “union? A eqtres a unied Example: uncon stedent § tnt roll_no! Chor naneloo): Char D0B Ca0],; Qatudl ) + Kige ofunten O apiol to tte fine th Laages} member, Uncen Moy only be inckealized te tue type of the firat ream ber, atatime + Ma allocated tu Ahowd by indinidual members ef une | N . Prthewcng Fe volue of ony va Ho member prul alley other rasmber values ® Tntsductton te ‘Pernters_ Poenter variables ave Used to direetty ace memory using Memory oddone and fern a verg wefal concept in the C. Lang cuage « The most powerful use of pointers “a bo dipnormrcattey Aktecati_ mermory for youtables . Every varias tn C language has o name and avalue axovatad With “h. When @ Vartable U cf ectored, O epecific block of memory wrunin te Computer iu allocated te hold fte vatus of Hod vorable» The Kize of tre allocated bloc depends on the type of tro data . ‘Pownters are nothing but memory addrenes . Degimtion? AL_pormler Ka vortable Hot contours The memory location or adver af another vouable . There A powler te o Variable that tepresentx te lection of a lata element , ‘ chem) oy Buch o a vowiable or an ovrag Prplisation: of pornbers _, etton and Uta te pas “npormatton back and far tn b Ofmden a fan a Wpprerce po’ ne + fox dey name mereory alle cation ef a vartante , anty ‘ re cn alterncle wouy fo occom endwuideal elernontx qe a ts prowede paws arvrags and xtingx as fardion ae 1 © te creatt” Comploa data ghruchares Such as Preset: linked tut, Linted 2tack» Lenked aneue ond gros. Daestomng pointer Varalles Rignter ¢ datatipe 26 ple nae 5 ovate Hore , datactype ts He dete type op Heo value frat fhe pownter pill Point te - Exoraple fat Krum’, enk eas Ptoat £P 2 Char *C', “The datatype a the pownter Variable and tle Vastable fo ihech ib pouts mut be the fame. : a let us declare an Unteger Powter Vartable and Chart uray oe in our pragiom cecle . “nt x =10; ant ptr, ptrakx Tr the above ataternent, ply ute name of pointer vascable These? ts a dereference operator and informs fia compiler Phot phys a pooner Vanabk and Me an Rpecrfies thot rh will Afore He addren af 27 Snteger variable» An toteger porter worioble , teardore , pout te ar Snteger voviable » dn the Last glatement, phy & anigned Hee He Odden of 1. The & operetor welvieves Hie adden of x , ard Cops deat fo dhe antents of th porter ptr, a Argue thot corepiler oontgn’® tio memeng (waslont foc twleger be &ayq Hig value of C=10 and the , He atartiog adder of % fm He thon Plr=loo3 Ln ©, poenters only the J vortable 1 ar 100% and loot + addven of © & equal to 1e03 i.e: preky, Dre net allened to Aore roernesy add venes, but Hwy can adore rddvemer of vomables of a qusen tyee “TRerepare Hee Rfate Sn xptr stor 3» ts abtotutely ellegal inc + The address fa ool A location 2 a Contant, therefore, ‘tt Gannett be changed tr te# progre: fo ‘tha valae 4 the. Merry + behon we corte, We con clerfererce a potnt 4-2, Befex oung unary % 7 opexoror oleo =T6, Fe JOO Varrtable te pohreh Ub points ; a Os “indvreckion operator Jas Ww ply Mery RP Vale of %. Trerefine, #8 ecpavalend to wviding Valera addres FL pornker variable Cannot be ountgned val of “Ro yon ble FO Pshich Ub porte . Can you tell what wll be Hho value of CLmwn), Ub & ceyubvalint ts num. The tndiseckton And tte addren cperatort are @nverxe of each OFLA ; $0 token Combined in an exprervion , Hay cane) each other, bile a Prograro ts Show Hie ws ¢ porites vor vials FH uncludscatdto sh > matne) 3 Sub nur, pnurn | Phum= &num $ int PC" Esler the nurbex\n"); . : Beanpc''%eod" , Loure) 5 Stl print ("" The number Hat wou Ontered= %d\n'!, Kenum): . pring" Addren of Mormber 2» memory =%elu\n", kau) > j Ne can alo ign values te _varteble uting porter lartabla and odtefy vbr volug - The code qisen below Bhowk Hats, tAtnctude cetdto-h > matne) $ : Ant nurs xpowm | t pnura=&num ; fpnum =10 y Xpnurn= xpnum+ 1s printeC'! Apter ancvernant , Value of nurabes = Yod \n'", xpnum)’ y ny Aureber of pointers can point te tte Aame addyen . The addren of \ Vartable U the addven of Ha fist byle occapied by teak voreable . Pointer exprenion and pointe, Artthroetic a eee eee oe Stmtlar & ether vanables, pornler variable Can alo be wed ty enprenrony . For exarnple , if ptr and ptra are porters , than tag fatto wing Ktotement gre valid . fnb num)=9, Numa=3, Zam, rout iv 7 mb xptri, eptray ptri= &numnt 5, phras &num2; Aur = xptri tephra’ nul = Aum x (Xptr} ) > : 7 Apbratals ; dive 4t ¥pttlfeptyg ~3°0 Tr & an exwrto fattsack to pomnter varables , + A pomter variable con be axtgned tho addven of another vant of the i Borne type 5 : » Dt can be aunignes tho value of anciner Pointer Voralle of tho Lame type. + Tretan be “athalized with a NuLtCor 0) value. Prefix ov postfix eeremont and decrement operator bo applied on a pomter vastable , + An twteger valus can be added or Luthroeted from a pornker vartable, + A pomnler variable can bo Compared wth another peinber arable of tee Aama type ee velattenal operators + A pointer vartable Gmnet be multipl ret 4 Contant A printer yoxtosu Cannot be added fo another pointey Variable , Dbosite @ progean fe print lompuber Science , utling pointers Hinelade catdtoh > marno) Chay ch = "Compuler Scconee'| Protel' Ae", oh) t ) writ @ Pregfiams te add too Plating porn numbers wing aes Hindludecetdto.hd maine) is foot mami, Numa, kam =0.0* Float *prumi, xprureQ + Pruro)= Lnum) Pnuma = &numa ’ prot CU Enter The feo number \n'") ° Beankl' Leng , pnurt, prim a)” Burn = xpeurss t¥pnuma ! inbe( Prent eC" Sum of fro Pleating Murbert =% \n!t_ Bum); Y ) wrt a roa te Colette Grea corel uring pointer Htrcludecgtdio. hs maine) double padeus area + double ¥pradius ' Praduya finda: ‘ Pointe ("Enter fra wadins ff crete ni) ° Beong "BLP, pradia) ° Orea= 3.14 % Crpeadioa) * Caprodivs) pointe ("Area f crde= KUP\n"" , area): b %) ori a progam te find larmget of 2 neomberx tang pombe HHinelude cetdtonh> Maint) An nur 1, num2,Mum3, Xpnure |, pnum 2, Xprums° Prurst=Rnumi > pnung = £num2; Poun3 = Lnum3 b Prott" Enter Hireo Nurberz\n Dy bean fl" %d Yo % d ‘VT, Pru, Preerg2, pnum3)’ TFL xpoum) > Xpnum2 LE 2pnuro| > xpnure3) Print RC" Num (os te largeit\n'') * che “Ut Gépnurna s xprum) AL xprumg SApnums) Pete Cinuma ts te largest \n'") ¢ Che prente C''numa aw Hie largert\ a" « Fe Opeeatrons - ww CARNE Th C programming + Pile ua plee on dale bear a gon F Cloted data stored . tohy fils are readed 7 Noe know Prat He Pinction Keanf 0? used enter dala fron Hee Lea board and printpey ts wed fo duplag the peut on video dep adt The @ works Pome then tre tnput data “u very Amal. Bat ak fu volume qf Ynput- datz erereaes ond toban the program 4 teyornted , the entered data i lett in progemntag. Lf gexwaa te Keep targe Volurce of data , ‘ef U time lontuming fo onte Fs, entire data. So, umeawity t Klere cata Permanently on dialc and ead fermi for Pllowng raatovs | . Th ‘y very dyprame © tapet longo vebime of data Hhorough keg board y Te & ima Comurtng te enler lenge volume of date coer: Keyboard . «ten we ane enterng Cala Hough keyboard r4 Fe prog ran ts terminated’ few ang reno ot torgubes fumed | oft ; entre fonpud clot tbat . Bab, of file u created , the ‘upomatien Can be aceoned agen and again easily pheno rensared vatng fee commards Degeateod + “File & a Confomer ondak to @ tare colyectorn retoted data on Atk + Vertow, types f files cure fet and boarg file . Text Ale! tshere date U Alored 44 4 stream Canaberx teat can be pocewed Aeazertiolg | Binary Piet bohere data ty gtved on fhe duk % He ted tw Fea Computer ramang « fame wag 4 wo Saproven Any tonpuler jeoruns Grits of device tthe hard dak, Pim (rendory cxcces memory) and cpu C Central prownng unit), On alt Hue devices hata can be stored , Files are the Bhoroge une on the hard Ik, bn Ban tt a tn tenn of byl and ™m Cpe ta to fem oof Yeausbeys . . Ang file pment on hord dak cwutd conte of filename and *e exrtiuren . Exarnples ! add.c—) extensor th ta a C Aouace file L, Ptlename a. Aludent,tet —> extention tf uo feat file Ly filerarre , ladon » Tela > exlemien CF is a tray file Ly fubnon ate Language prt ue & Pooter te Q gtractare ¢ type Pree: we Pte _porstew A_file porter ua ponte o chucdye fiyr Ete. | © pointy bs taformation Itoh depos vartous Hausge about 74 file, Hading Us tame » cumant pun of Te filer tobatter He flew” cing sead or prdten, and Hhether errors or end f the Pile Fave ured Tho user doe not need to Enon fhe detailt, becasue the legraitions opstatned from etd toh Gntlude a Klruckwse deelwaheog piled ETLE, “Tho header Prle Zaldtoch> provides Ha prototype fr Ho rlo fanettom and dagne Hts type Ferce . dh order read we wvily Pile, Your propam needs fs ere file porters, ‘ To obtain a file pornter voscable, Ute a ghedenent Vue fret? [ene fe | The « ; ap trat fp u the file pointer Hat poms fo a FIle ghucks Comrnonlip wed C File -Syrtem Feenchto nd J Funehiod DescviphoT —fopen 69 cpens a file PeteseC ) Clogs a file putec> posites a Choroer te a File Fpatee) Lome as putcc > d geree? Peads a charocler Prom a Ak, * Paerce) Same 5 geec? a fgeteor weads a ating Prom o file fputs ©) pre 4 hing Fo a file Preeke ) Beekar ts 0 gpeciied byle tn file Cet He position te dered byte) Ftetle > yetnom ‘the dansent Pile position ‘ Lprint pe? ay toa Pile thet printf Fo Fro canrate frcong C) ‘ato a file tshat canpeya fe Fhe Comaott PeopO welunn Prue vp erd-of- fik @ veaked | fersoxl) eho druo of an ersoe faa otkeved : pened) ests the file positon Gndicaprt Fhe begining te file, vernove (1) erae a File plese) Plashes a fr te Streams and Files FI “the 2 flo system Aupplies a Consistent MterPace [ He Programmer Rnd ependent 4 the attual device berng acceyed , That ib, tho @T/o aystlem vides a level abstraction potween the prograrmmer and the device Thu abrhotken ty colled a ktrearn, and the actual devtee % Called a File “me ¢ File sgtterm ts dargred te work mitha, wide varte of devicer, inchaden fermtnale , duk. daiver and bape dyives, Even thou each device ih very dypgerent, the buyered File syitern trong orm eat finto 0 logiealdevtce Called a atram. Pll Atteams behave similarly . Becawe gtreanw are lo device dependant, Hhe ame faineteon thot Con write ts odut Pile can alo uve G dnotner type ef dentce, sack astne contole . . a Phong a file ( Popene) ) The fanckien penx & stream fir we and linker a Pile wrth a File pointer axcctated wun frat file 4 then wolerned by He, foyer, “Panchton« Most often the fileu a duh File - fpeobitype fir tte Aepene> Fartte? | ms sw fapen (Conat char x7filename, Const Char wrote dz | * chere filename U4 a porner fe a ging, Charaderx that make up vatid Plime and ale thelude a poth Rpecifitatn Anether rameter a pointer f aq pteng, name mode , determine hou He ile can be opened. “the felow table shove the valid modes tn Whe a Ale may be opened - Chrings tuke"tstb" Con abo Le wepresorted Z br" sa v opent a bert fileRreeds i) Creal a fexl Pilerorttog a append & a Fab file rb Open o binary File For seating Wb open a binary file for erkeng, ab append ( a binary file rt open a Text fille Poe read/uxtte pot (mate atest file for vead wile at — | @ppend or Cratra text file for seed, orl. file for vead[art ' xtbh Open a Binary pote Creat a buany file for vead/re ath append ov cereale & taut binay Pele Pr Yead [rele . Az aan be Seen ‘from above tabl, the files can be opened. fn fhe fort or he binang raode. TP an error ote then Fe Pyoner fearon 4 opening, a file, Uh reliens anu pointer Une fopenyto open a fl named Tha Plening, ead phudetic fev veadv Fike Py ApafepenCtahdet cl ayn) Jaden a file ts opened to road mode, Pheu “ompertant tasks are perfored by fepent) . O A earch cl Carted out onthe d @ wf te file ufound , ov ae ae anne ae meomory fron . a Q the Bib vs bro large, then te ple eer = ue “He Pile wo net Pond, 2 NULL & relirnd by poo. “Bato. bk Conbatas a mroere difued as NULL, bsheeh urdroko Hat He attempt te open feo fib forted , a powder - The borer ® Bdpere > tran omen Lote up a bk porter & a goat of grit Atruttare and pote jo roo. Lived Chorashor in maaan eyo. pa fue 4 “The macro NULL a daued tu BHio pened Ativeg ths above matrod ; Paper? deter Any ervor BL oy a RM ak « before” nn Pile, Ruth om vorits — protect te write % ab | Nace cue d te nd cook Cacbere fil. porter pall omer Rov rporing wHrenptng because nO po Ru va opend Roe vrcking 1 ON reamed Robe. wth, toon oF UU Thu u became sa treaked - TP yerordé tu be | gh the wuode “As bw Tra rome WB be crveswrdten , na write mode, A New dded te an CRatng ub howd be op . . te a file w spend Or oad fone operotions 2 ce vit wot be 20 t ot ad, uot be ct . Uy ex uth. Hevevety ied does not E0476 : fern a fil (Pela? ) The Palorec> Ferateen Clowes a chveow Heed von opened by 4 col te Popon ed, Dk esnttze any dal quit denoting Hts dul Bystes level buyer te feo fi ond dow O Pavol Dperaling anvde wt Fads core a a trearn tat dota , dehoyod Pan,ond poole Adorned Omer YA Your program Petree alto Pres tte Pile Lerbol block oonovtatsl wen ke lucam , noking Ub -cwactable-fev res ¢ Cine Hr Ua liver ty te wher of fle won Can hare oper ook any fame yee may hare be ebege Our hie Pile before Opening anottey . Peodely re» — Gur Pelee (FIle fp)" wh Pelote CFrLe fr) Mew fp “otto Pik pornlia roliminad by tue cait te fopencs. Arlee Value of geo Bignipe a Auctertdul Ure openabion . Ths feuchion yohan EOF if on erry Occerr , : Iysiting 0 chavatker Tk c Tho kyo dynes two eoynualent funchignn Hot putpct a chorater — pute) ond Ppuce >» The fuo0 “dent rtal Punches opert Alupligte Praerue Cepabatty ath lev vowteo of C The puter Panbien rvther cbovathers eo file Bab was rari cpevad fey writing Weg Me Parone > function prototype * [ioe retary mE «PO 2 oe paberat th PELE SED) | and thu He Urarode Wow fp ta He pile potter velurned by Pope, : t 6 The Pile powder felle puter > bhich Pile to wr , 2 oudbput fle po ee . fittiough thu diytaed at om sub, poly te low-order by iar Tp 0 pusce> Bprabion ue Ruccerfiel fh vet Ha choneusler 7 pftenare, t vabivos EOrCEnd of FUL ) “There are abe fro ecynuatent ferret voor Phot aapal aclowader— gqurco and Pgerce? The Fforee) funtion wea ds chavorters from a Bite openad rood rode by Peper? ‘Prototype * thin fp 9 4 fib. poe a EI LE rehomed bi obtC) y claw 4 a. 4 claw On senkeget | bute dhorniber UY Cembateed “ut fla low bye “The qokee? Powstion —_ an to wton Hla ond of he Pile bos beon weaved . However, gk? ale years POF Y On exror OCeure « Pours ond Fay? dand wrtte C. Buppette He -Panctions Fastze> ont putt) ea. es ‘foo ond to a. dut PL Thee Pemurtow vost put | petee? 2 binge daaacker aad 0 order hoster chr vok and gate pub datend -of vending oF ooretog wrur ghigs > : protolgpe ss yess _ aatr, Fue fp) > | cut Pputs Clam chav, Ver xFget Corer eee Sut langlh Fru xfe ee eee : powted te by th te fe apecyied fle pats cy femctton writes He ghey The Pgerec Peateor reads t abroann «Dt law FOF yon error OULU + cunt eur a vuole Charan 4 a Ring “Freee He Apecyped Adreare Yeod ov vag 4 dhaxadort howe Laue bean vend 1 Tlae fesetee retains “tr * cn error OCR , sack ond 0 nub pouter feat ; You (on peyorm yonder sead and wil wou wg 2 Th xystenn oat te help of fist, panes cer Tee fel potion udriodor . 4: Protoly pe ee lat Preek CFrLE * 4p, Pr long So _— Hore, fp ‘a He fil. powler geld by O ct tb Pope, Fra nanber of bytes rome ogi 7 Jehiels ur beter He 20 and ovigin Uanbe = ug 4 fib, Une ont priucen , End ce *fiewo) You com determent “Fle current tocaren of a Pile wing flee, Prvtetyre De velurng, He location of joa unrert porition of fle Pele omouated with £7 TE 0 Partuve oceurt , eh roan 1 x Fpwotge> ond freonkt) Brewer ond facantc) behave erodty re pruatpey and tant) excop Pak they opastt wn fle - ay Pedals: : | ‘at pratt (FILE €£P, cone cher forte thing [ug vaiobla; ‘| tet Fecont (PELE ¥fp, Cont dew ve canktol a brtag » addven—of variable) Whee fr wa fle poles gehrmed by a Call to fopency, PpnltO ond Freange> diveck Herr Llo operations te He file powled te by Pp. i fest? feogd Panetion detex Gat peopl Atle RFP). A Poop) rete ue tt too end of fle Pile has been eached ; obhers tes, at yotmm Ber” e memes tchen the Ord of the fle pos boon Chrmunterod’, % Fervent? The fenort > Pmettoo Aetowsimes therter a Pile operation ha, produced an exert + eae Qnt feroe CPI weep De shee fp ts avalid Pile pointer. Th Fetarna Mus ty an error nas oe cares dueng the lark fele operation; ottensive, ib yobs fale . Because each fil cperateen seta the erroy Condition 7 Pervert) Vhowts be cated inredtirel aye cach PUL cperatron ; oftasuiise- an error may be Lokt | Srewind) “The sawindc fametton veoh fer file poaitton tnd riabor fo fe beginning of He file speared as tt aoquovent That try Ub Mreninds He fue : Peofohpet Void rewnd (Fre a fp) 2 bolere Pp 4 a valid file pointer yemove() , ban The removed) faunction esevet fle Rpecified fle. protetipe” eee f [fob rows Conat ctr fied] beta Ber ¥ Aucunsful . Ofternne, of vokoms a nonzero valae f Plush O TP goa wh toflesh tro contents of an output £feeam, use tha Felutho) fonct ton, 7 Pretolype | fab PP las hCr cle #efp): The fainter ssriter Hae contents of any afford dot to Hs file. Meocated with fp. Pf you cou push) wun Fr beng null, otf ler qperad fe culpa are flushed . The ffluthe > Penteon vetears Jer YY Aucee Pal 7 ofterwiar, it colts EOF + Frama of (ategortes of Feb fembions © Termatted Tr Funttoo — freanfl 2 Dbeneatied outost — foreatge ? 3) uyprmatted Lypat— gebeer or fastec), Pyetsc? H) eunrratted output — putcer ov Frurcc? , fpubs ©? ©) Charodterd-nput Ee que? or fgetec > ©) charter outa cos Fa: puted ot Foubec D » Fu peritioning fanskiow te ’ , freaked Pree d + vesind ¢) A ©) bre tty Potion ts: . frog) + ferrore a Fite easing or RePrerhivg, fanbions A * Temove t ) “Fak For the Derertplron of all ta functions and Syukat Sefer me Desnphion alt fimeleons ont by ome sith Profotype and etplenation , i ott O lvite a psogom te create a file Caled erap-tet and plore t fnpormadion about a ferson, tn terme of hu nam, age and daloreg Fincludecetdioh > tnetade catdib-h> marine) § FIie #fp! Char namel50I ; Ant ages Pleat aalaay’ f= fopenC "emp. tet", "w0") | : =! if. Cep== NULL) i printpl"Ptle does not exethg\n")’ Oetco) 4 printel" Ente the mame \n"')! Kean l"%a, name)! Ppt PEP, "Nomex %e\ 0", nom)! print eC" Ertan Re age\n"); : BeanPC" an, Lage): Pprente CPp, "Age=%d\n" , ag) PULEC" ENG te 2 ey Roane" %d Le 32 fprint£Cfp, "Satosy= Yd\0"", Pataay): fetore Pp) 2 ® sorter a proguam te Sued a file Created and Stored &n Heo disk and ep lay 8G contente Hindudecatdto.h> Hinetude cetdlth. hs mMatnc) f PILE «fp; Char filename RSJ > : : Char Ch}. Fi a PrtntfC Encik filenorne (3 be epenad \\n “)? Beangl" Ya! , Patenorne )* fp= Ffopenlfetonamne , 5") if CPpz = Noted printeC" Cannot open file\ ne Ctto); Ch-fagetc Cfp Mu x Ihite Cch] = Cor) print PC" %e", ch): 1 Ch=fgetel fp) » fetore (pp)? D uni « progrom © wrt a character on a fila Hhenclade cetdio hk Hindude ¢ttdlib +h > tmarne) 5 FILE xfp; char ar fp = fopen (Lemp. bot", nod, ‘4(fp==nvlL) print-£.C" Eovor~ cannot rt a characker\ n't) xk CO)! i intf (Enter the Charatter\n* oo cong (\% CE", os Fpure (a Prd; Petore C£pd! » wottte a programa te wead a characleT from a file Fheneludecatdio.h > Hindludecetdt -h> i mame) . 5 Prue «Pps Char as FPpafepenl "emp. tet 8 el 2. £(Pp== nurrd ; pratt (" Egror- Cannot weak a character \n"9; Cer CO), Pete eee lohile Ca! = For) aaFgerelPp) % Pont Pl" Foo", ay% fetoge (Ep, 5) wile a progam be write a ching be a file Ainebuds cetdto. h> deenctud e 2etdlib-h> mom 0) § FILE xfp; char 203017 Ppa fopen(empetet "mS Sflpp==nore) f printp ('l Cannot poxth a ahiog Nn“) exrtC0) *, ‘Granty (enbe , Gerced! nthe aking nn) | fear le, fp)! fetere (Pp) / © nite a Progtamn G read 0 Rtg fiom a file Hinelude catdto-h> Hinelude hte eb. kD Traine) 4 PLU xfp! Char xtPlo0} | Pp~ PopenC"emp. bet, a) 2 1¢.Cfps= noted f printp(" Cannot reed a thisg\oN) ny evikco); Fgete Catr too, Pp) 5 , rate l'%ea\n Rte); felore Cfp) 3 4 ® horite a progam te write an tnleger value ints a File and then Yead Hat ‘enteger ond print value of the nteqer-. aN Hrclude cetdto-h> Hineludecetd Ith +h> rained 5 FLLE x £pt ab pe ~ Zz Fo= fopen C "emp tek, "40" ): ‘£ Cfp= envied prott(" Camot wrile\n"") ' exit(o) ° j printf C" Enta te integer \n") 7 Kean ("%d" , £0; fprute tp, "%a" 00) felote (Pp); Fr=fopen temps teh s"0'') | freon fCpp ,“%a'' dn 12 poatp C" trleger=Zod nM Ve Peloge CPp) 5 va Command Leno Arepumentt (Onsmand Lene Arqumonte ave gpiuen after Hoe name f the proofom tn Covynand —Line Abell d operating Systime . “To Paw Command line arqunolt, he tipreay dapre matned mith Heo asgumentZ Feet argument us He Number of Command lmne Oaguments and Levord “4 luk Coramond - (tye Arguesents , General gyritort' ° matin (tnt ange, char targv0 I) . . JK» A { nthe above Beto . argc ( AR Curent Count) U @t and gtorer Number d Commond - line Arguments Porsed by Ho wer trekding “He name of tho proofards So%f we paw a value ts a progam, value of Arge would be Com fe argureest and one pr progtow aame) + + The value of ange Should be nen negating 2rgY CARGurant Vector) “t onay af Character pointerr latkeng all tho argturents . ip ange is Juater Han Zero, tHe onray Olorments fro argv Cod t asqvfarge-4 J bul Goatatn Pointer te alrgh *“ axqvlo) % q “the name fi Progtam, after Aat Hu orpvteryt-4J every element % Coramand —ltne arquments . + They ave paned te reatne sferehion + Thay ore pararockers/arqumentt Rupplied fo the progtarn bafon UE ‘a Anvo kod > Thay ase wed b& contre! progam from outside antead of hasd cocking Hoge value @neide Heo code . ogrled hold¢ tho name qf the progam . . , : angel powka to Fro ferat lommand Line A rocernant ands og You pas all He command Line aagumentt Aeparaled by a Spawe, bul Y- digument nel has @ pau -fhen you can paw Auch arguments by Putting foora Anside Clouble quote 7 or Bingft quoter”? Cpr th ara Conde Fagen v£nJ Pornbe tart argument « Hitnolede cetdto sh > motn (tit ange, char #argvl J d $ tnt counter! paintp (" Progam Name t %8\n'! , argued ) L *florge==1) Prente(’ No extra Command Ure Argument paned Ofer Haan Preafrary Nam \ n> iflarges=a ) j printt C" Namber d Grqumonts Paned =%d\n" , ange) porate" Following are tte Command line Argqureds Pumed\0") for Ceounter=0; counter Ms , ndename arg menté fugntea? Comma Unie arguments — dae from the ziniple FO fro Complex « Arqursenta ray be either opttore , Cxpremiets fashackons 1 fRlenarees ofc . Baie Unis Commands Baie Lines rn ) date dar ee & wed to duply septa date and ferme EL, rent . " Fame PRY ener, trys mma yew ma mab UEnY So $ date ‘ Tue Dec 10 [8saiQu TsT alg : ve wilt not type deg Bgmbet , uw Jpe virtble on fo ferminod Boron, “tu the defout prompt che) - date +h Coonth name ‘4 Daplayed 7 sdott +%d Displays the day of He month date +% D Date in-He format tom/ dd/yee : diate +%H Dupleys Hou in the teme $date +m 7 Displays “Time im tts forma hhimen’ 8s ddatr +%M Minuit wit be duplyed $date +%S cums wet be deployed 4 date +%m Ment, numbéy will be duplayed . an ddatr ty lark foo legut of He gear Win be duplayed Afler ta Command dati we wit give ont spate and fillowd by tot we sill mention to argument. 9 cal , Ditplays tre Calendar of Cursont rnoath “bal 1a aoe : Displays He calendar of De tamber roonth of year Bog ) toto Displays Ya lab of weve uateg Fre ty fle ) le Linte all fila and Divectories present in He Pilerysters bk -2 Duploy all Piles and Dirertorees oo with Pele permencon—yead(r), puvitrCw’) and execute(s) - : OD be Te uw te bac Caleutakoriued for perforrnerg arithmetic cperabtow dhe ats (t 10o*o so Cebitd J 5) tho am 3 # tho am} . Dusplags Ho Cunent wer name, : a $ he am % / kumar — ptx/to flug 1 OF:%G i Cptras heaven Com) urarne _ Duplays cortam features ef Fhe o¢ vanning 8) Your mache L oS name Uname SunO§ Display verkion of OS 4 ¢ uname 5 oe Disp hort narne 0+ rnathine name £ wrome —n ) ps dup lauys tha poowmes Danning on the maching f px Plo TTY Tone Cue Keb 204 console ®:00 6) To clear Hu sereen ¢ tp clear or ¢ clear (5) we To twount the number of liner, words and charaters un a file &: fwe Bhivatxt aban anh deel He, 6 UQ ghivate F Ss $ we 2 Cro. of tims) A ne -w Cno-of words , {yy ea Cao of chavathera) &: Aowe Lo shivacty + 6 Ahia-te F ot F To create a tent File in ee Cat > ehuatye tt REVA UNtvERSE-Ty VELA HANK BArGAlore [ebtta] “Te duploy tro file confente we ean use f Cat ahive.txt | {3) man To Know fhe ‘information 7 arg Lomraand we Can use Man Comrand me £ man ave The above Command Aeplags the Ynforrcacon About we tammvand TH qou tant te know fie informakéon of man command “tell, Hen We Fe f mon man pod . . The ocbove Command duplays prorat rorting Divechorgy ms diy Tt duplays tis termrnal nant mkdir Lyte: rakdir div_name To create a duvechory . Directory UU @ Container wAteh Can held Kub-divedories and files. 1 Ex: f mkdir shiva ) ed Kyntar: cd clty_name Wed 40 Chong He path or directory fiom te rect directory fo. tuvvent divectory : fg ed ghiva Ante * wmdir dtr nam? To wemeve o Directory be L gmdix abe sem (8) vi Byntex vt Peloname sc Vi Coremand “a wed Py creating aC progtiam Pele Ee ¢ vi addic. (ce Fgntet: co felename. ¢ eC tomond wu med fer Compiling a C progam file oe q CC progtarl. C CP Command v9 ied & copy fro contents of one Pile fe another + Th replaces the content of ‘deitination file by Acurce file Agnter : ¢ cp filet Pele 4 Filet U the Aource file and file a t He Detkination File Ex: £ Cp program. Programa. C A /) cmp : Command us ured for tompastig Ho tontente two Piles. T-both The Pile have Aoru content foun no marsage wit be duplaye d Santas: t emp files filed Ba Pemp Progfant, ¢ progfeamaC Ga) mv mv Command wu wed for Q purpose @® To move fly fo Directory be 4 wv program!.c programa.e Shiva Hee shiva ‘uo Divedbory . be are moving prgfamie and praqtem 2c Bh fhe dire dory & To venom o -ftle be ¢ mv Progparal. Prat. @ Here progfiam!.c is Kenomad as prgle C ym bWrmmand uu wmed te delote Ho filer. Be a ¢ om Prgtec prga.c Viediter Cyinual “ulerttiue editor? Bill Joy created vi editor Yoda of vi editor, “ @oorernond rode: Dsjoutt roode Vt edver , shee every Key premed ir Treaked axa Command. TP we wantte ‘tert a tent wo “have fo be w7 ‘Trsert mode. To Zwich te ‘wert rods we how te rue "7" or "imesh Key ‘ © input or tmertmoda *. Every Fey prone affer wtichay fo Hu med @ Crehialt Shows up ar text. Prewing "eset a thy mede pabe vi to command mods ©) ex mode os lashlt molt! “Te moi wed fo. tare Files fr cating atte condenty tle. rent crmaie Tt Pe Prana an ta the Command mode takes w to

You might also like