Download as pdf
Download as pdf
You are on page 1of 21
faites Og oe eg Hog ah CAanguoge ta12 ~ Dennis Richie y Agee. 918- Brion Kernighan eats the Long a KGR Both went 4p ANS) ~ Amencan Natonad Slardad du ute ie —Nomed arc bonquage com epujerto any fee 1987 dweloped fo Aubo ¢ Cred TbE «tara Borland gntinahonel Comporep ae A Grpotont aipsch of cng programing long: * th oa ab sores the ony U chats on Rola + The way ab actomplshia zip & olp « Th oun a conhsts sep uance TF anghushion 2eeustion Anatogy of Eng hiah. dong. with ¢ Lang Alphabets — words — Sentences — Paxagaarh charadir Ack, constants, Sntwelions, cpgter Alphabets, numbes, Kuy works, Syntax 4 Special symbols Pakatigss, Semantics Valuable chonackar set + Mphabets (7 A-% r ap Big o-a VY, Sp symbsts. +- #7 \, fesd@lacrci{}?-a# beg wouds: the Keypeoorels axe abo callid autrvecl avorelt. Gxtain words io © danquage char a standard g opit-cliginect Cheecal mmuoning umd only dor cnterdol quanores + She wer cannot oud fine atte auarved averds. She xuaved words one as follows: 34 th mumbu Auto ~ break zase- Char— temst - tonhnue~ default- de- double ale enun- extian- PWat - -for- gote- 4f - ent - dong de geatir ~ subun- sortmsie af — etatie— gruel’ esilcie’ typedef — onion unsigned — void— volatile — urhile ~ printf — Seaaf - signed aalloa (4) Feat et ichoractaisiin of ¢ Bepamaring danguages (or) (Simple: cw a simple tanguoge, in the ene that ib quovidis a . Ext J Atucluacl opprtoch Ct» break the problem ino post), tu atch mat ot : Hibrory fonchont, dota ys, de * Machine Indipendndint or portable + Unlike ofsembly Lang, © progam’ con be eneustil on cuff. qwachines Ane i Zomme machin Apeci yer changes ANC Ma fnathiqe” Fndspanslint Chars gi onguege * Mid- Lael eyreraning tanguage : Alough, Cis intended to do Soru- fuel progromming St & urd to aly elop Aystem opplicahens Auch os kunel, anivar, etc. Jt also | OE the feature ob a chuigh- duel Rangucge. Shot is why io a4 Frown 94 omicl- Level Language cat $0 1% Struclured programming Longusge : ” cpio C i @ Ahuchwd programming Longuage in the sense Hat ave can - Sh break the quogrom ints acts using funchens. So, ub i enre umelustend Sp § modify. Funchons also provide code sumscbi by tem Poe Rich. Lbsog: 8. C provid a fot of inbuilt functions that male He apeslopneny @ Post | = Memory ranog ment . Se pupports the fear of dynamic cman allocotin. Inc bonguoge, * St P we con Pece Ha allocatil erermory{ ok any Bim by Catling the freel) By Cor | Punckon, + Bey + Speed : 5 ‘ + Com: She compilation § execution Aime ef ¢ tonguage i fart Hn Hone aw. Wueer inbuilt funckons @ hence the Qusir. ovetheod ey + Points “3, the C Povidu thn feat of pointers. We con otineally “aknoct 1th the the MOY by arg the pomtens. We con ane eins for manage 5 She i Aku clus , functions, oray, ete ¢ fell ot Gn ¢ , we con call the funchon within the function. Jt qurovidys ede Suusability for evoy funchion. Reewrsibr enablurs wr fr une He approadh op backtracking « Extensible 6 danguage is extensible becom x can comly adopt new Peatins . “Constants io C | Yontable ine > Whose volue Changes duning exacutien oho enkily Whose value doesnot change: i» called constont Classification of wnstants _ bonstantts — a 5 4 Shins —hamnie charac 4 Steg, Rol 4. dntigr comb anck + Ae Sntigt Lonst. emus contain atleast ( Bigit « Ue must mot contain 2 decimal point » 9b valu con be 0, 4ve, ve « LL mo sign ctinerds ib is omsumed Ao be a tye cen-otortt. lemmas 6) on blank: Spaces are vot allowed within integen tonster by 426, - 866 2. Real const + A Ral Constant must contain cctleast | Digit + St musk contain o cledmal point - Can be 6,+ve or-ve + Beparett sign B we + lommas csr @ blapk space axe mot allowed & 42-64 , — $3.04 “3, the meal ow. chos to be sepretnticd in on exponential form , Aik 3. ge ci! Je can be avnitten os 3.42e-th She part aibianing drpore © a callih monte 9 the dott ellewing © w& calls Lxponent. 3 chonadir constant? “44 + A chan. Constant a@ Aingle alphabet or a digit & a Al ay rok Va writin within Uvetled commas is called chonoctin. umslant a dal Sw fs? 4 4 Shing lonstont: A sting Worstant ds a A0guince of ons or moe choraclas, endo&d rsittun coubl putes f “India” - Stucke of C- program or basie form tf © (PILE Iweivsions] —¥ include < coniouy C wnstant derintions] CexTernvAL VARIABLE DECLARATIONS] glial 2 main C) 5 Variable declonations 5 Lov nm Program statements 5 } [user aerined Functions} Sample pore oH include #, include < stdio. b> Wiel mein() + Moin function , cleanly p 4 vattioble deelanation ink ob, Cs ere ea Scant Cyd yd", EP, 8b), —» ampul Line q Ce asks 5 prow Line . Printf Crd" e) ; ev getch cy 5 be } ay aae Variables tn C moe 7A Vatiable i a mart of the “memmey Locahon St ud te abre ‘data. 30 value can he changed, g ik can be amued crane tis, - Se ww wag do supacsent murrron Aecotion through Sybil 4 that ue con be gasily identified She Syntore > declase a vatiable : datatipe Variable List 5 A. ink anteg 5 R. float bees: 3. Char ¢ 3 Hare a,b, ¢ one variable Gay tloat, chor ant data types Rates for Aifining voriables: A Vosiable can Fave atphabeh, digi, § anduscore A vortiable mane can Atak swith the alphobut, and undir score only. Se cont Keak avite a agit NO abit space i allowed within the yoniable ome be any suserved word or dey J Ht, twat, ote Voll Yootiable mnermes Snvalid veniable names 7 it a; a at £5 » iat Lap, 2. wt ab; 5 wr a2, 3. mt Song; keyword “bokins th + A token is the smallest anit used wal oad Purtuahion € word that fou come 4 token pranam. Lach § Aros in C program A tompilia breaks ao © propam in tokens ¢ then Proceeds ahead to the next Atoges Used wm the comp lation foo as cA < pregem cownsts ot various tok 2 a tokin can be eit a Ruyword or an idenkfiacer a uemtant, or a shang ditsal, oF o agmbd or an epvata 4. _ “ie c J tant , f ~FHatitication ot spit q stacied a ty words Fdanh ties Constants npn : Keywords co. C Chane A Rupoord. % a amwoved word. You cannot use tk os Senn 43 name , Constant nome, ote Shy ane only an runrved words (By rool & © danguage naebaind: Ste A dink st 22 hujwords in © language & * tAule + break + cane + chat + urmat + tembinute + ofauk + double . phe enum .extan . float + WY + Qeto nic + oat stong st ogistn . suhuan whotk > Arigna + sizer encou + trucks pwiteh . Rypeasf union sunsignal « Void + vatetih | gus + do ai satatic + hile a4 Sting Sclentifiers fC: encle XA co identifies & a mome has wed by identity a yauabk, tune, or ang sth anr-ditined “shem. fin udinhfier stonk with a Lotte a A wz , a bg oF an andusote (_) followed by no er more Uttin , unduscorer 9 igib (0&9) 26.49.23 i * ¢ downot allow punctiation charadias puch. u@,¢erv, Ser | within iintifiens Sn FF Bw can censitive Mopamming language bs, ey Aand a an foo olitp iduntifiom tn C at i Put, for conshucting idenkfias in C & 4. She fiart enum, pointe, Qonge oF vats cb primitive dake ype: Format datolype rh Range Sixe ae nha -32764 bp +32967 le biks /a bytes fleat nf 4E-34 bo 16437 32 bils/ 4 bytes double “ig 4.16308 bo LAE 4208 by Lis/ ebyta e ’ : 129 har. feo 129 > 4 bike A bytes Case char) Datatype modifiers Moclifies ane faywords , ured to emecbify int ¢ chow catabype dhe 4 typ vp modifivs att arork , hong , signed @ unprignad %) mort - St con be used only on ink Faqs F shonk int amy shonk unt = @1 W Long - 3p as mumd to Above sveug Aoage omimber. Urually 9 ellen trillion eg Leong ink wy Aongink > (896913429761 W unsigned — when the “st antends to store ony positive volue & Lnaignect int amyunrighed ink ~ 536% WW Signed- when the wr intends ky store both -ve § WC value aigned ink amysigned ink = ~538) © lp & o/P Functions = print $() and seanfl) tn © * Bvols + The Acan $0) and print$() -Panctions ane used for inpur § eubnet expre in bi >» de © tonguage. Both functions are inbuilt Librory fu chemi, mde ore © sedio-h Cheader file) ‘ ws ued for oulpet. St pank{ () + Prat 40) -punefion= dhe Print fC) -fanchon Prints the given statement fo the eonsole. Jhe syntax of function given below [Paints C "format shing’, anguma Di] Ey pring OMA ans) 5 © Gon 40) funchon - She scanf() function 1 wed for input It sods 6 fp the input clata faem the tongole [ Apeet [emf C3 fora arg — Eq: scant ( + Sh The format shang Can be rd Cintepet), /-¢ Coharadin) , ysCating) “4 (float) ete | + Be Stdio.h and conio.h . Hie en 2g wnony ¢ include > We ~ ou) toe ana Jo y 1 Q= ©0000 ool bs 0000 6011 0000 900} Ans: a &b=4 5 K3.4 © ° t expremion 3; o 3. Bi She oy Decimal binoxy Ce bits) 0 - 0000 ooo 1 = 0000 ooo 2 = 0000 010 Ww) tio! 3 - 0000 oot) | eam 4 = 0000 2100 : 5 ~ 0000 olot 6- 0000 on a J- 0000 ON! e- 0000 1000 oo! he q- 0000 ' lo- 0000 1010 h- 0000. toll In- 0000 100 3 - 0000 tlol Ih - 0000 ) 15- Oooo =! AL. Bitwise OR: Ip the bie wed of ang one oF tea corresponding emat qprctor 4 4, Thun Au Ofp will be 4 othawise & is Wo. The uth Aable of bitwise OR i atb let a=5 be end ifien fesute . Dpaakon) | opustion 2 | = a» ©000 elo! oO oO f ° b= 0000 Obl! 1 jo ! 0000 ol ' ; ! 513-4 3 Bihwise XOR: dp the bit valu yf ome dhrond tsa 4 the ots 0 She o/p utd be A othuawikt tb is Zo Condition | Rev Th truth tabu of bitwise XOR? apaatn | opene | oO G | a*bh Let a-5 a+ D000 o1o} ; ot 4 b-3 ae | b= 0000 ( . | 000 » foe |. 0 1AB=6 =a a § dh 4: Left shite opowtor = guen no The Lift vhift puabr aufts tu, bits he syntax of Anite opnabr is [Variable “Leptahipt aprator n 5] the Lyte de €4 a<<2; Fa: Left shigt 2 bik in dom 206423 20 = odp| 010° 0101 0000 5 3 Oper p> s0<¢2 = 50 5. Right shit epurator : The igh Alpe ofurator shifts the given mo of bits to Ayof ‘the Aight side. Jha syntax ot ahtp t padler w chon [liana RGEC gat a7) + on fyoasa; anus Fa: Right sift 2 bit in do = ao 3305 n° 20= ©001 oibn | Preced 0000 16) 5 4 p> dora25 & ones Complement : ° The bibwise tomplment omrater is known as one ommplemment Se ts arparsenrt by le (~) plement . wu 2 complement spssatien on any bt opration on d > 0 becomus 4 § 8. Special oprrators: She special opaators HC one. ()> faunckien call L] > Areay subs enipt + cdot) 4 membuship opaatot > Comew) + memory allocation. Size af + Size TF operator + Ctomma) -» Seporator Operator precedence 4 ausociolivily to C + Operator precedence: chitumin the Grouping of tums in an teprension and decides howd an exprusion & Weluatid. Certain oprators crave che ghr precedence than wthis 5 for example, the omuth plication opootar hos a duiqlis precedence than * opratons assouiatvily a umel ath a optaton of same pucdnee the addition eprabr oyuat dy ax exprusion, Aisoriabivily Con be. citar Lape te aeghe oy stght to Lape Precedence Operator Desouphon [Maneativit 4 ++—- Suffix /post-fix increment | cuunernent 0 Function call Lor u fervay subsertphing Struct § unien memba aus ma Sheuchin § union Tumba aus Lure poirlir hype) Type cast epuater ae8 Prey inotement g clcaurnante a alt 2 + vnory Mus § minus Les 6 fn kegical wot and. bi tevieg NoT be indirection ( cleraf rence) & Adds - of Size of Size of 3 */h Multiplication, division & nemaindur e 4- Adslition and Aubtrackion Lar p << Bibwise lyk and aright sige 6 ec Fax selational operates < and $ respectively For melaWenal eurators S and S Acsp Yee Y= Fok relakenal = and # USP wo 4 & Bihsine ANS 4 ‘ Bitwise KOR Conclave of) Lok fe 1 Bihwise OR (inclusive oF) n Ka Logical AND a " Logical oR 4 m Pe Temany tnditi onal \ S Aimple assignment ; mp ong RSL He = Masignenent by sum § aff Ree the Assignment by product, quotient 4 "4 nrernaindia = >= Assignment by bitwise Sptahit § ea &2*2 Ie Assignment by bitwise AND. XOR and oR J 15 > Comma, mes Monaging input § suljut cprators Ong Hormatted r/o tunclions + Unfe © The scan $f) anc PHot{C) function ane ud for input 2 uti i a < C lon guage. Both functions ane inberilt Ubrory funchons, clepinect in Akclio. h C head file). + SeanfO Panttisn- Te Seanfofenchon & ud Jor inpu Tt riads the input date trom the tonsole + Syntow > eanp Cformet Abiing”, ooguenunt ist) s A Eq: scant (*7A*, Xa); 5 + paakjO funchon- dhe print{() funchion & uKd for gubput Je 3 prints the quer Abatement bo He erst. he Syntox at prnty! 4 function % gven below oe [pnatt CHormal ating’, oxgument tint) | 6 Ls : } Fy: panty O7d *, am); + The format sbing con be Ad CInbega), he Cchanachy), Ys tshang)s 74 Pwat) ere | Lenvasion chonacke| Desvtiption § Meoning BF Chonacker a | The program kaki the data un the form of charcaetas a Je program purforms the conviasion ct thu [data into integers ( decimals) $ Th. program geruratis dats eulput i th form Of a olouble oi a Plat with the default of 0 precision & o The program identifies the date as ashing, and a ingle cherackr trom tis sing get grind unlus § nl the program Atachs a NOLL Choractir Onjormatted T/o -funckions + Unformatted I/o -functios one used only fer choracha date ype BL chara cher oxrng/ sting ard cannot be umd for ony ottua dakatype + Jee funchors aw utd Jo sua single inpuk Prom He use at te Compl ord jt ablows bo display tie Value at the umdle + The fanciers am calcd unformatit To punchonm became Wwe Connst Unt format Apect fiers in “thse functions. 4 getcht) 2. putch() 3. gttchaa C) y 4 put-chaal) 5. getac) &. putac)

You might also like