50% found this document useful (4 votes)
2K views75 pages

Module1-Introduction To C

Basic Structure - Execution of C program- C tokens - Variables- Constants - Data types - Type Casting

Uploaded by

gomathisankari.v
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
50% found this document useful (4 votes)
2K views75 pages

Module1-Introduction To C

Basic Structure - Execution of C program- C tokens - Variables- Constants - Data types - Type Casting

Uploaded by

gomathisankari.v
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
You are on page 1/ 75
@ / on tt-L | Program Develepuank & Trtrcduction 1c “ ‘Pegran Algorithm 2 beweheik 1 Prigeecsie Pacgram x dafinad as a Aaquerch we with e 9 Trakruction uoticen bo pattern @ evel! ologined kaw compuker, Prcgrom davetopmant Aye-qyde i a TE UW Oo Akep bY Akep procedure Used bo bullet Coreputer progam. 4 Thee Akops guides he computer Pacgrammon bo las cod progeare 22 Aakisby Problem beginttion Raquina ment Kook Aho end wsert. Program deoign Ne [ Pazgram costing | Dour cat tow (i) Problem ategineeion, + AX Bejore Tiavleg tra Ackation ougsaily andorstand tha Rature of Ada Problem 3h, Problem (Aikeation. | lau. Ragatre mane onahasie = | % Th bs Aired os oe exp ockakl ony | lof Hie sey from the PLograns . | we Rojaive nant onatyis 4 a datalley Study} of eta Vosiovs opaalions perocmed by te “Progr, ana qrs velatiostitp coituie ans) adie outi dle fre Program, Po seqiremenk erably sts Skoge. PAcgrammer must caciole tis dotioust ng Ww Type the Fopute oka (i), The neadedt oukpak: Cbructus a Gi), The conditions and covwalewaivs undo, whith dha Puogram has to operate, AD. Program aasign - Hs Ty tte Smportank shep So Program ln volo print Biko tyle ATL Programmer do jus. tellasing koases. (iy-plen tha. folubfcn bo tke problem, | (ly), plan dhe oyoiatl struck af the PaAmgrom. | Tee final program clatign soport vontoins ue | doting | A flovo chor | & Record \exyouts | a Oyaalt plan pr Solving The problem \“- Paogram cooling \- | & Dn ts Akoge the program Assign | By rons dg mad into computa: program. B The prograce code mu pasdintfes Jthe kolteuting propatfos . a) ede musk bo Afmple end clos b) Te musk be woosable. and stmpie ko under tkand, @}, complex Logie. end Jerieky cocking, Should be avoided. (Y). Testing and Debugging + - aT 2 a process hotecking anol corracking errors fo a program, X The main ofm of dis procoss B ko mane tue program ko pecduce do oxpeckes} Tosuhts Or ON occamiows. ® y (Vi). Documantatton Te Do writken cletailed druripty jabout Aka Program. Athe follow’ng must be Fncuded) fo Leite: ghosagiuinballon i a) sigio and nakwe a Problem B.A brelf dosciiption abouk | a the program ak ha dowdhouts & tha data ‘records C) progres Stattags and roswlk, xe brood clocuumaunkation Arenp es the. vodorakendiing matacananca anc wedorign of to PAggran by ho User. (vii), Mefntanonce + HTL LB Asfined of a process of wa vermont Ens. progrom to caussy ouk OW or More Weq) 5 | given bela —— bo corratt foulbs Gi). do peeve performance. QS), bo match the wor requirements (iv), bo make “Re polfey changes | Peng rammfng languoges TE L Rgyinad a a mettrod +4or |eornuntea tion bokkwoean, man and the cormputer Hot | uses A Bak precdofinad coords. | XThw0o voords ore cormbinad Zaks A Progra accoreting bo om Ayneaxl rites) + Typos a Prcgramming languoges | et loo level longuage oF mactuine lengquag & High level language iy Lew Jove) languoge !< | The longuega —enoon fo tho computor Js called tow Iwel lenguaze oF machine language. KX TE WIE Alsram ob words made-up ja ols and is ker coronene - eTuds Language is maurine dopenctank, & Digporenk ky pe Og Comnpulzen Use— cbjporant rnaciiine language « eA, coor It VO wana Advonkoges :- Ui). Trambakion, 24 nok Madad , tiny, Big level Language > Qi), Execution speed as igh 1) becouse obredtly andorrkends the Srsberc bond Disadvantages Uh. Be bs very chipset to Program Gi). Dk ds veay Af ieutd bo Undierstanc| (16) mockdne [anguege Vemier prom matine ty machine GW), Ever correckion iA Vows olipgicutt. # The lagguage known ko the PavgrammerC human) ds called tear Jeo} language, ATU lenguaze vier reaaning ful wordls ond Skakomants as wed tn Exe\ien hanguoge. Advantages |— x So tk ib vouy easy ko unolerstood, eg, BAsre, gorTRAN, PASCAL, COBOL, C, C+, JAVA, VBpsres o&C- (Dk Zs Very eoy te Program. Gi), Dk is maine {oclopendent (0), Faerov cocrottiiws Ak easy, Qa Q Dhadvantages af U) Exewbre Kine Da wogh Gi), De necks Lroulatior se) Woy level languege mut be converted to low level language before, exec on, Foectnues of geet Pragrarerning langueges I 1d) Fimpttathy i | He A good Prograrmnifag language ats bo | Aten ple ko learn ond Use: TL can be emily undesstond by thE | pecqroromer, (1 Nakutajness BA Yood programming langues re data Stuckures , conro! io mule provide Sxare operte Bloruckuios and a — AYREAX. U0), AbsSero.d ov | # DL da sofived 08 A” grouping of oasentio) dakalls and Ignoring offer ctatatls , % PB progroemitng language ADU vee ie abi tty fo olognte and vie complicated dheruckures, Gy, Expiforyy = 2 good plegroroning leeguage mutle be Supprted with. geod langquaze Lranshakor Joo Jranthake Ugh level language to mackthe wale, Thee code mwt/ocy Jor moniony Spa and musk be executed fo less Hime. (yy. Gbruckuted as as: ¥ B good Prcgromming langusge nowt Providk on envivninent to olivicle. Fro given Peoblen| Sinko number of eb problems « TWA 4 Oo eppoustee Sb Prog tom fev cack Sub problems, x Go program wiiting | deweing ond matntanane & ee (vi). Compatine 35 i- # B good Programming Jang uoge. muse be able to express Hu Frtentlad opetation Concinaly , (it), Exkomsibillty % PB good Programing language mus de allow, the programs deo extensl brew gmail doo large. by mans af Aimple aod naka qochantim, = (Algetine = Tk is dofined or oO dhkep by pkop mucthod Ie polve a pacblem stra Computer. ea Properties % 6), Fintkeneas oe & AN sigan te Towdk — Jeoreni nae ag kon Oo Kinde number oh Vakeps. # Bach Akep can conkoin mwa or move. | “CUA out brome Xwo choles, (at, byportivaness ‘- % Each © by Q person ein pend] andl kop fn the algorithm mule |e abla jo solve [Paper fo oa Awike pmourk of stma, tiv), DBopak '- “RPP algorithm musk accepE Xero’ OY move. sa, Be) — a (), Dukpa An algorittin musk Papseuce., Mor . outputs Classification af gor? then :- Lessor ent fre @ bes qi). Bac tracey Ager tthe UW), Divice anc cong utr algorPthen Sank G0). Dynante Progreroming algoritions QV), Greedy algoritin (v). Branch and bound algorithm Vi), Brate force alaprtthe VID. Ranclomezed algorithm Flow chart :- The graphiccy wropresentabion ob he algorithm £1 called Low chart. Tmportana of PMowerort '- ~ Flow Chowk 2 Useol Ao woprosenk tae Aequantt of operations to be podtormad fo a pict | | form, k Flow chork Peovicles Aeveral +y mbols covraspondiing to oliffeenk oparcticns Uri), Ona flow cork 2 cbr. te bs Ven emmy ko Foplowenk The concept using any Prngramming Janguage. Floochark Symbols \. OvaA -~ CD — & incdiote Shaul or and of the plowehouls » + Parellegran -[_]-» Zodfeake Zopur or pant £ doko - 3. Reckenge — [| — ko Indtcot prsce sting + 2 i j 6. Atasw - soc fort - ei &. Reckang)c wit soap em} TLL) ~ mates Vortical 2-h9 2 Sub pProgrouns fo connect porBens 4 Bowehore slr. So cliftecnk Pages. A Qumbe er a Jotber — 4, Labelled connector — Ore ai la woniken, Spsicle the uxcle circle withthe Aare lethe ov pombe. Sy Comnetted fogetha. is tage — QD = eae. oo Advantages of -oochak | dy vommuaLeationn | 4 Flew chat ads as a Maclium for cormunicabing Ane program Sogic Jp atl Who Aac it, Gn, Efpertive Analyysls a Flow Onart helps tho pecgpreromet, Jon anclyse Apa. Problem move ofpectively, | pmrocthfi cabl om , C20°F wrretkin. etc. wv). Bap dent Cooling i A Flowchatk ath, as a bluc Patat 47 ee ® os Pagans huaing Program. Loding. \o- Proper dalgaing xX Flow check balps the Programas to olobugg tne programs eoatly, Exonphe Ager PNg ovi thm | Flowchout . ‘ | Axoo. 7107 | Croumdorene = 207 Algsrrthey Ff low chore Bear Tapue + yw chiumboene <— 2HVAY Prao > Kee . cea 2 we Ae Examples ~ do - page ts tea) Brewoaction ko C Hokey of cio The yok, of ad) Mocha Languages % ALGoL , frbtodueed fo (960s, ALGO) war ta irate ALGoL , Coupatar language kb» we a block Atructwe. & Th 1961, Marte Richouds developed o Longuage catled BepL (Basti lowbined ieee Languages for oviding system Software - AT lqio, Ken Thompon Creaked a language using Many teatutos a Repl and celled a4 8. | X Both BCPL and B wae Lypeless System progromalng danguoges. aC! was ewlved from ALOoL, BePL anf B by Denn Ritute at Bel) laberatories To bara, ¥ Tn 1978. Brot kommghar ond Dennks Rekenie published fie book The peogranandng Longuage | Ten ‘Uo jscatted a4 kK2RO, i KX Deerican Nabonal dbeanolorcls Drabituoe (CANS2) appointed a kechntcl comalico. fo laying a | Qeandatel kere dy Na 8g. THA 2 called a4 pns> ell Bk wos than appwved by 250 in 1990 Qtr vouin oC incaied O88 C BY x Te 99, Hie nero Joatutes of He Sava. 2 added © C and bnew as C QQ. > | Feakues q “c’ - xX TE La Pexibie , Nh Jove} tetuck seo Programtng Janguage. ye Bi Sclude Ha feakuas of dow level language Yiwe amrembly language x PEL portable. A program written ber one kype 94 eorputor can bo used So any otha type - | cb Ba mare Lasker andl appichent. | hou an ability ko extend iUseld- | * Tk | a oullt Zo gunceios | yw Ph hos ow number conta Mauss the Programming Lost Aimple. Skruckue YC program + OU OWE AH Oy Section | Link Setkiew | apnisien Sextion Global dactoiakin Sati maint) dunttive Seti t Selauabim pawl | | i : ‘Executable. Patt, | be - [Subpacgram Seckion J | FEscigioa Ly Wwe olyinad € nt dun ma, i “Dotunsrkation sackfow /- DE cowlsts of a sat of cortnrant Tings Qving He nome a tha Program , the author ond otha cdotall. |Link getkion !-(or) Tnelwcle seckl om | | DE provides Intruckions Ao tre vom piler JS Lin funtion rom dua rysiom Ltbray. KDE i aho called as Eocuucte Soto. | ythe header diles are focuded In dnb | Aockivy xeThe Tocludad Piles mut begin wfdn ffs 'eg). #induch ¢ shdfo. hy + Debindat om seckius!- # DE dpfines atl Ayecbolfe vomtants , Global declaration gectinn |- | R Some Vatlablos diat aro used th ncre, [treo ove funtion, That Variable 14 catled glee | Voulobles # These global Vouiables aro cleclas en in the global clacbsatin teen that Js outslle of atl the duendhens. Maint) deanction feudun ‘- % Every C Prggram must have one main) gunttiim Retin, A Ts Aeekion contodyy deo pacts. SDeclaration part —> Exeoutable port we Those ido parts must apper betwo2co She opening clostng braces . a Pll the Akabemonkn [9 nts serbiun Wewd bei enced with semicolon (3) # The program execuiion begins at the brace, @od ends at “the, Closing brace. 8 NSE pceane Section | BE Conkeim ati fo user dozined fonctions thee 010 called fh the math Jfyanucton. x User daphrod funrBions are placed Sromediskely after the moakn funceiin. | Exarnple — Jtoatia a Plogrom fo fing Syussre at XW Qiren nundy he dFiodude ¢ gtdio- hy Hinduda K conic. hy i) | vota enadot J h tink 0,8 ; Palate ("fp Enker the number”); Sant "yA, Ba); | &2anxa} : Panes (“fn Iquore 2 ra", 8 J | 3 | Execution, Sh © program : Reouthng ce program bes fellovs!ng Uceps. Vs Cyeaking dre Ptograns a. compiling ne Program 3. Linwlng the program with fenctivss, a. Creating dha program | Fopen the buboc editor. *® Dr the ectdtoy enter the Cola. and save the program. X TUE General fore fer Aoving ona. croak Program is, Fle name — Rana of tre Program Cy Pile extorsisn X This Program io colled goter progrem. 4 Fg). — telocbudte. { &kdio-h > AT oobucta < vonte > Void malol ) b ok a,b,c; Prineh ip Ender Ane Valen for ab") 4 Scant! dyad", 2a 26)! ce adb; . Patekelte ¢ volun ts val" 63 Getebtd 2 3 x Save the file as anane oy [Sample +e] Nid, Congiling the program Pe 4 a Peocass q Converting dre Seu Program Sato machine language Program. Htoupile +re created program using Corspile opsicn 25 kurbo ct edkitoy. ¥ Th dro Acume program Ly AY nkax error tree. , the coupileg Aroulake the Aout Program @® [bw non exeubable Programcaied objet PSpremg | ATR coupler outomatically Kanes The jopjoue Program . The general porn fs | [Mlerame +ob§ | whud, Shlemane. - Nome a the Aowce program Ob) — file extortion | 2g). | Samples obj diy. Linutng tha prsgion SRE. Luthetfons 2. x Lining % ologined as a process of conning othe programs and functions - ; * Tr kutho c worpiler, tinving 4 couled owl oukamatically of 20° conipilatton Lotng process tonvats The ok) Progra to an exeentatle pkyeck Program and not |The Program. | XW genaal form B ohne filename — Name of The Acuice. PLogram sexe = — File extension ae 9 Sampler exe, 2) |Uivk Exeusting (or) Running ths. pecgram |= x Run the executable program wasting Torn option & Turbo co edtter to got the result bev etka Progrom. prosenk torre TL any Ligicl error Rowen Program | dhe program re compe. ang Vin tho jana agate ron the Program , [Dagon vropresenbation of Prggram exocubiin puccent- | [sae pegen)~ Bake ower oo 7 = [Sgitess Link on Sydtem | Herary | Excartable program Yes J paig gouiee progrars | LL . 1 1-3 Variables , Camibonks 2 Dako foypes /— Charaka gak ® chatacters khak con be uted to to coords ,numbars anol expressfons dlopenc| apo the. Comipubor or Whtth fre Program Ts run, THO Chatackert CUO groupes! xato olootig, 1, Letters — Asr-) Baek Q- Digits — 0, YM --- 6 F b 3. Spetal chatacters - LAY AR + =~ LI * C) HERA pit ew Gy 1", @$ Ly 1? kk. whith Spaces — blonk Space | her? kab, Carriage Yokun, now LPL, for feo! es HC Maes Certain combination of chatacters Suck os Ve, lo Ve, \E Ww Av, \a ko clewole § apoial WiReceri sae sr Reieved woords ARepoords ore words belonging fo © Language . aA Thay have Stoodard predapinadt Meaning me Thee wovels Skowl be used only tv Atak Dkeodad purpose. m The wers have no Tights 4p change me keywords sroulal bo written Te lower Care ey auko | econ sizeof brea, oak al L_Le Tokens — | | ak Tn ao Passage Text, Snotividucl moors uokionw Marks aro collead koko. aod punck Trolivictuod | Ob © Program, ths. Amellost nits are incor os c kobe. C kotons | | OY US \v ae @ koyarrds TWoniifies vowstonks SANS Speciay — operators Symiols ‘Tdeontifierd X Toartifiers aro Rents giren & Vartobley 4uruion and otner se defined obj ests. These ore User dAdfined Ramos ond Umasints al Asqucnm of, dattoss and aigies , witra Artter as a irk Chasatkor, TRE fink Chatatk er musk be aAlphabel A No gpectal Cheuatkers one alowed on undescore(—). a They ae Ja Aifjaenk Hrow Tao’, oth. 4th cose senive Thok bY 29). Ao, BastePey, bosicpay Tete _Pry, BIZ towkenl? '- XR cgutant i: 0 Guawbty whore Los nok Change. cuking Program exouen_ Comikonts tt Vv A; NesmeaTe vonstowta Chouacker conskonts 4, a Pakeger Real single tons Chota kan, & - covatan> Numaie trakank Direct En « Pk is a conskank made up of bight ant Sour Spockay chotackers, = Brkagar tot) fixed poitk conscank = “ig Bacagor constant Je mode OP epctigits uolthouk cleetmal points. The Vokes one kyo — 3A tes to + 36T6T. ae An indegen costae 14 Aormod att. | oligit Or09. | Tho cowkank 6O0 be preceded by + of — digo. X No Specoy chatackers AAS allowed any where Br dro conabane, a). Dedmal Pakeger constant F % DE Ta rade ap of otigits © tg, SP) wets Lime digit Awad NOt Pe Zoo, eg). Io , +o, ~SHBO, STS FkC- \»)- Oteat Takeger wretank | | RPE ds made ap of digits OT % [any combination , | | | & Dk Auculd begin with'o’ | C8). C4, C1564 , C100 | 1c), Hexa dactmal intagar Coniconk + | | APL is mocle up of oligrts of 9 and jolpnabets Ato F i any combinabion. eitny RP Arcus begin. wht OX oF OK (eg). Ox58a , OXIF , Oxlf Real conskant (ot) Floating Poin Condkenk - & Pry purmber worsteer cofth sno cleeimal point fr cettled veal Conakent Sr) Poathng print constant & DE ts formed ote clighks ote 4 and a leckmay polnk. : % Digits befsre or afker te deuimol point | | can be 9 Omittbed, % A Dumba can be prewded by + or — S&o | % No sported choracars ace used other than etme} potnt. G)- Fracticnal orm :- * OB purmber written with one domed point is called rea towseant Bn fyrackional Kore. | eg). -O-1ST, -64, &.4 ey | \€in. Exponent form '- | Dk BH used ko represent vey lege land Vou Aroall real constonts, X The general Aor a (wai eo = ecco ee ee The mankasa ond exponark ¢on have. o- | positdve. er negative Aigo. | = not has a cesimas | & Exponent Alwowlel ve / *potne ae Exponads muse heve lek oun oligik. 3), 0.0000085T! can be express eel os ~astien> Chotatker Consicank - (i). Direct - HA divect chatacker Constant contlets of a G Single Chaata enclosed whtta Siqgle qeonation | x THs gives due | inmoger value of te | Fenclosed Chasackor | % Tus valus bb prown 6 Ase Vodaw ,— Set oO -4e | Wer 84 Yal - at Wi Escape Sequence — ON extepe Sequsne eomalata of move one characte uttntn elngle quekatl on mars, 4 The Qirst Character muse be bacinslos’ BE hes More dhe ont Udeinite, fe | Sopresento only one. | eg), bel) - ‘eo! | acu apace — '\b" form food ~ *\4! Duty chosacker — \\d Skving Consbonk :— A SkiNg UoWtank Asa Ravana of chatacters eleclosed within clouble Abotation matla- ee er | TW can be. formed sid oligits , a1 phabete | land &peay chorackens, | 1°). “igopusetoee” “Nig-Meyf Mp 2aus’, “ Ses! abe - ’ , Differena between Character Lonslcosk and setag combos © 1 | Chatacket constcont Seng comakonk 1) Bk produces ratonest Po Dk wa Aeqpene of Valve LASCI) Q4 Jha chouacker |\Charactort enckored whttin [entered wiinio single-qyetea| gouble quotes. | ‘*8. eg). ws ” \pB/ 66 | | —___—_———— Variables *- . | x A quonkity whor Value chonged tutes |tee exoution. of the Peer *& C Variable vokers ke dro Nema giver. am Ja called oo Voxrioble- ko dna monmory tecobton ko Aboro dete ¥%P Vaslable Name Bs Korened wit Alphabets é digits and a Specta) Cheuiactor Undlorscove(_) of The Abate Chorercker must be an atphahok x No epeciod Chatackers are Cucd Ofher dion andlor score (_), XBolh appercose and lowercase Jetbors arc weg Bae dusy aso Not | \ x Dk proud pot be aw weseved Word. Jexeaked as Aome, Besre-pay Yyolume » Biz etc. 23) Ao, | Dotaty pes and Skevage XC lagquage Supports Adfjetenk Jeypea- Ri Base oY fundamental daka types % Basic doka types ore dakatyP Already defined Fo tna langaage: # Those Lypes whl be supporedl by Jno C- compiler. 4 | _ : - ee ee | Daka type | Desodipeiow sage TT | L bya oy & bite Char | a Chatacker in The 4 | chouacker oat | la bytes ov 1b Bites fink on inkagar | floats la ftogle. preoctal on float | % bytes oy 3a biks pork number a Aouble predistor & byes ov by bes Aouble dloating point Num ber ee fF - (i). Dedives daka-ypes A Daived clataiypes are olecived fm dhe collection of Acclar clakadypes ewith adetitnal relation. |Suips between tie vauleus olemints qj that Sealer dat a tee Thay oxo alio Eamon as a Atructuied cata dupes, | x O Supporks tno Aplloutng daived data, aypes ao ergs > Fucctony —> pointers | —> Sphruckutes | Datatype Oualtsfers:- | 1 ¥Daka ty pe Qualifiers we eegpoorda Hho canbe Prefixed wiht see bale data types. % The qualifiers euldeva pea Charackotics guck as S120 or Sign & The data type . RWS igen YuoliHers aro, Cy: Signo + Sign Quatifions WY Unyignad oy long : - Rize qualifiers UY). Shove & Called S190 Quatiffers | MX Signed 9d ansined quallsiew are ia F Long ond Guovk qualiffers a16 Calley Size YaolL fore, Those odgorts tie Soe of ape lakartye, Bowe — | Allaved me : . sie Ronae. dake ty fe! qualifiers bike _ 3 27 cho | MPagned | unsigned 8 -1ae ko Signed Signed Chas (ory 8 5 & ass 2 | = _ Tne unsigned | omaignat Tre 1 © ke £5,535 gigned | Sgredingsy | 1h |-gajtes te 32 7H7 | ink | 3a Law kea tae & | | | ahgned lo | 2,197, 528,647 cansignest long int | Shark Sore Ink 3 |Lyas 127 bn to ko 4,9 ALT Signed mae 8 | oke 255 = 8,197, 483, 64 200 887,483,647 Signod Short ink] © 8 | _ yg to 7 _—s | 3 Float - Flom Ba | 3-488. aye et | “2 haa 2.4E do a | double Jang deg eee e wpEthse® Declatakiin af Vouiaslos /- at Pll the Vasiabled present fn he Program musk be dactsog bopore be By wed. A Decloratim Aeolls roe compton wWhak dhe Voulsde powe Th, PE Apebties coat Type of Aate dhe youlable will hold. x The gennad focen As | wre, datatype — Valid clakatype gacn os 2nk, Choa, eke | Variable Liak ~ Mok of Veciablos Sppataked by Comm a 2g). Enke abe y ie AVB.C char None, f nome L&D Vv TWA declares He The Numba 25 dha Squane bracket Yepresents name as Abying Vouiowe, Maximum Number of Chorackars fb tho Sdering Plus ove, | % The losk plaw Aste \o Character ke Wepperent | fhe end a the Abving , ©9). Ramu. bd |. 4 3 Nowe Poitrabizing Vastablos /- The Process of arstgning \nitiod Valtig &o Vouiables Olusing declaration ts colled inttiatiadl Variables. a Ths genaal form datatypa Variable = intHay Value 5 | eq. Ine @ = loo) tneine cha Sexe’; | Aasignitng VYabus b Variables - & giving values to aitablen as called orsigning voles 40 Voi ables . K TWh tb done CHR The help of | powaneah © petater. x The generat form 44, Vexlablename = value | | ohne Variable nema. SYalid user cloginad name Z es), ya aoy float ce aya; Declaring Variables as voraconts | * The Veluc of cesses Vouiables to Femetn wriccout during tho excuation of & Prosgrem. de Wa can ge tubs by aatienley line Voulabla. wily a keyword ‘tome? athe genuas bom, womk caaktatypa Vout te wohee, con - keyword Aountype valtd clateaty pe_ e9) wut float pre 3les HPD Vous Awoutol not Chenge huty the exocuim dna program. Dectaring Variables os Volatile '- ee The Vou ay te Variablos . ale, He moy be changed — atidng the. execukim wh tha. | Program - a The. Variable Volua Mog bo | chonged AE any dima by rome Pxkened Aourtes. # The genera} Ast Ay Yok datatype Variable ; whee, Volatile — Kero ord | Aokerype = Voulood daka *ypes 24) Volatile ‘Wat x 5 Overtiow and underttow of, daka '- x Avigning a Valus were bu i bites Bea uppe tint i called Ovorgiord . | wounn is a Aaiguing ov Volar. jaa Tete, | dis lacrlim& 2 called underflow. % Ovelflow Produces pagettve Number posiGVve Oumber % Updetflow Proctuces Defining Symbolic constonks - ¥ Symbolic wrskank wo Rance that ton bea Bubskiutad por a Yaluc that comnot be Chagge| ETA Value can be Nurmedic Constovit or a Clotacter condkank — or oo By Conant & using compilakton of Ape. Program cock occurance ef dha Aymboliy corstcoank 2s wephwad by Des worreaponcting Yolreo He ThE genaral form Zs [Fear soot Vata) cohne, Aelyina - Preprecency olfsective Nome — valid Idonkifter Volue_- A Vals choumcker Combont ov theFnp Corstonk oy numeric contcont ¥ Symbolic Wrkont are cunally choginad ak the beginning ot tre Program | No Blan Smce B allowed between fond Aafine. fe ficlafine Skokemanc Aloud set end coh geeniclen egi- sHolegine, PR 3-4 aAdeginea. Yadius aS deolgyine DT float taeol ) i Dr wea! —> cuuning vompilokion DT -repla cad by pleat. “ area = A¥ PL 9 yoolius {> duuing complacions PR Aa replatac! Py Bly and 3 vacius is veplacad by as. Header fles | HHeadox files ate spectay Fomucr 4 les which Conkaln Variows Lbraty function = & x Libros, fuacaew ate pre won Leen ° A roukl nag function ured do couny uk vemmonly Ure XK To we ane libro function & the eo col $i | Program De & ecorioy do 8nclucle she AP File leontn concams THe Punceion eloclatalim Lotti Te Paar. | A Daalag Coropilauter, ste Incuded hoadex the will be metged with ane program. etne generad $7 fe, OMe. 2 whith cliverts jas compl lou , dHincola. ~ déveckiv do merge tne Kastor file, Filo nome — rome of the Voosor file. 9). Skolio-b , Siaaiy .h, medh-b eke, Commant Shatemant \- | ¥ comment Akabamants are Wor executoble disakements, X Those ate ured bo Yncrosse fhe | ° Yeadabitity and andervstanctiny SE A Program, B\\ Comment Skakement, Aeould statt |e (* and ends wiih #1. wtNo spa Lb altooeet bekwoon ¥ ard /. XP Comment tan be Fncluoled anywhere Un dha pregram. 29) | x fanttly to coleulake average £/ Cc operators :- % Bn percieoy La AYmbs| eohich “represents Axsws. Operabtan thae can be Pertormeel on. cages UW). PRtpanatic Operertore + ag Antesetc operation are used t ho aritimathe cal crlreios » *& Thee cro two types. ny Binoy oparcin ss * Bioary Shiai neaodl -beo eperancls [kor operations. the genoa boron L [pest FS open | Ohne , operand }, epeaard2 — Vahid wnribaas or Vatiable, Bo — Binary operator @ | *F | cpa | Atatin Exomple | _ Sabreraced ge xX-lo | x wultiptication | 4? 5ag | Abeanen x25/3 =1 ev 1.67 | Tomainaes fed] X25 % 3 | eo olivia j Oi) Ura Operators a Eee Operators neo only one operand tex | Opaakion. The geneaal torn & |bo operand Whuc 7 LO unary opaabry opetiand valid comakenk or Vaslable. fi) Rolelimnal operators _ | & Rolatfonal opetators ore users ko dfnd our line wlatfonsktp betweor Iwo eperonds. THR. gunetad tam aL : [opeandi RE opband2.| cohsre, Opeiand |, opetand2 — a Vall tomkank oF Nosiable Ro — volalienal operate . R Ralakinal operates are useol ko Bod out tre Jevuctboeas of opeiands. Gi, Logical eperakera :- ' wTogical 9 2 Be wrod by find cut SS | ap The gonesal xm LL | | the yelatioubip bebooan Telatnal exprew lors , @ | [paces Le opera 2| WhaLa, Operandt,oPaand & eValld olatimal expromler jo - Jogiccry wpetakor —— —_———+ Operabor Meaning, 22 AND 1 OR Ms | | \ NoT x Loglcay operators roku resuthy Jo the | following Kable . | x ¥ x 2ey xily T = i T 7 | Ti F & v | oe . j - - ; wonue, KY 7 Pelatunal expression, FJ — Tree Valuc | F -Febe Value 0 (i. Tnerement anad chetremerk opeators 3 Thee ae oo Apecidl opuckors ine ‘oo woukscl fhe Loops, | | % These opeiators aie cated bncwo moat and olecrenonk epetakers, (Touremanle ©Perakor - K tt Lb He Socrement operator, ATs adda | de Ho Value vontasnadl To 4ne Voutoble. ¥ Tha genea} form 4, pn = &g. 1, att > B2arl ‘Qa. 44a ~ a2ad| 3. a2bt4 > 225 b> bt! hh. aaatb > be FI arb Decreomenk Oporakoy x -— Bb Ha dlecre mont operator, % Ths pibkracks 1 erone tas Valut tonkaina, kn >a Varlable . ™). H#Tke genaal form Ly Wie =|) oy 9 Ea Veafaliej ye. --a + aca A. a-- Dara-) 3. A2b-~ Yaad bob_] We Os ——Bi 5b, BoP Aob Skok hand arsignuone potatos % There are operakors witlcn ate wes) te Auphty the Gosdtng Oh Ovignaent sbatenanth ¥the gansat town fe, Variable speaby = express a whee, VYorioble ~ Vali user clopinad name SPaiN = ty a hy dH 7% FQ). Opecalor Meaning Example += Velur of LHS Vayiable. X 2 X-+410 =) woll) ba acldad te te K+=l0 RHE Volus ang of ipnad fo Liss 2 CS Wi, Le RUS value will be Artbkiacked fw Ly K2xto2) . ost Vouiabla and is amignad sree bo Lue vafable, Valua of LHe Variable. witl be multiplied by x2 xxlo > thea REE value anol , yw #z10 as asignod fo LHS Variable . Value a LHS Vahrabl ea. i clivided b: will be i YY xabi/t0 =) the Rs Valu and 2 auignad to HHS K Jzlo Variable . Vales o LHS yasiable will) be olividad by RHS value anal Pre. yemainder vill bo RB=l0 Skored fp tre bis Veutable X2x%lo> Conditional oe petabor:- ¥ The condctoral opratey Pand > ae wyect 20 outld efeople — conal2G ona} expra gsifen * Th hoe three opaands, & $0 Te Ls couleo} kexnaty operabor: X The gentral form a, % expressive! Li evatuaked we, x Be by deur exprosttona 1 evalualon * Dh expression’ | ja fale , oxpressims 8 eValucked , €g),, bigs a>b pa: b # Bp th, omdttin arb fy baked Hirst Dy dts ka krue big20 ele bg2b. Prewtse epaator | HTL tL wrat & do bik by bik Opoatin ° peraloy Meanlrg & Bikwhe AND { Bikwira oy s Blewise Ex-or » \ BiLwBe aight surf “ Blewolia Jog k suipt ~ Blidhre Csmmp lemant te AND(&) KTH loperation B Cartel out between | kw0 bP pattons H the genital form & [pera 2 bie partana 3th. opoatin anawg boo bles rene pettcin! and Paktaing, Ghecauled ouk accovalitg to oa ruthiobe Bie ome Hom utpuk Pakkani Patten 2 bik 0 ° oO ° | ° | o 2 | 1 ! eq). Jot X= O10! and ys tol O10] 4 jl ort ———_—_- olol 1k Ad x2g Bikwise or (|) KThes epaation 2s coruted cue potwoan wo pote patterns - ° . Sethe general bor | at The operation among A bola Patter ate Cauied cue aecrrling | Bib bor “Bie drome owe pe groom pateern a, bo tee Tuth lady, Patterns Patkern2 o ° ° \ ° | Fo | B Let x 200) and Ye 110) | xiY 3 o1el | l1ot —__—_—_— jlo Bikwive Ex-or> HPL th cauied wk betwoon Javo bie pation ¥ The gone form | = | bie pabtan! ® bikpatkon 2) THE Operation oreng kun pits from Pak ern and Pakkand aio Gui. ouk carding ‘ Jerath koble - “4 ae = @ Bus + BLL prom oukpu Parka | Pattern ° O° ° ' I ° \ ° 1 ° ! \ . &g). 3 Lok X= 0010 ond Yr lolo. xy s ooto too »>;oqooo . ad ees Pikwide loft slipk ( <<) % This operation de used bo Abipk tee ‘ ble pakke atk, # Thuis operator pygdls kwo oparardls, (DA bi Pakbew Gh), an Jokego. Hak ‘reprasents the Newber of ipl . ATRL Gorcial form is, bit pakkero <¢ numba % AvILL dl > # Dusieg exocation , Te bbe patkeo oH ty. 0) debe Atco. Oh operator ¢¢4) wat! be Avifked owe Soph Elks bo bo Aub bed om cts (2) Pceaiding 4D tha Number * wight Ade of dia opetakor (<4), ¥The nerber O& bila saipred BE eS ye wil) be eomPens abcect by fon he fle sole ef fro. be pakten, sue EPP PELT | i neegEo vite ® og Gltle Teh e3 polled filled bia Akified | oul — eee ODT T Tedd Lphsise wige ALE (35) - TW eperation Bs used bo auiph “Hee bit pakkan r\ghes xe TUS opotatey nosds fio operands, (a ble pakters aqua number Y 22101 Gi), an inkege tote ‘represents hia. Pumbar outs, ¥ The Jeneray Aesm b, SS & c / d x Dutieg oxourtion, the bit pata on fhe dod Atcha. opaatry (ds) will ba Alef ked out mgt acunding ko Ht numba of bits & be slifbay on duu rage dike af he opetato (>3). a aetha number of bolts sudftaol cule or ciao IgM etl eC be compensated by equal nmimbot of xatos on tte Ang jog He ob Paktesm, ee = PTT EETY | X22 9 5 1 to © (oy | | eo © [eft [i fo] 17 acd pe bs dilled bite aubtieg xmas [elo] ol] ef Bicwse comple suite L HTL: opetbor Changes all He Zeros fo one and one be zoo fn the bie pakteen, HTL general form ts, /&9). Lee x= 1100 Nx = OO}f Spe al opatakors (. Comma. Opmater '- 7 Dk ds used bo Hine walakad Prony, Aeogastnen, : 3 aT genaal $7 A, Where, variable - dgined. Variable. expr, ...exprn — Vadod exprossen RTL expressions are oyaluaked from Jape . bo right and dno vals tus ight monk exprovifin, da tha vane gy Te ceonblnad — GXpression., Som =(a2 5, h2 ao; ¢ 210, athte) |°)- | a), size O patakey s- | 4Tt LD wed to dind 4uo Numba | bytes occupied y He operand). Tha genetal form th Variable = si2oof (ioperesd) * 7 €g). ink sum} ok m= sized (Sum) 5 Tho oukpuk 4 Q byfes. Ui) DoE operator + (ov) Member oparater *TE LD wed bo Give data tw He dll grruckue Voufables frctivictual mombard. tha gencial form A Skruuere Variable . momber Nave | awe & AOhue, Variable name 2 member | any ordinary Vortable &). Skudent) sage 5 |). Addve as opuatoy (2) . x The addsoss of tho oof tr tha Walp of, +H. address operotor. ThA Operator & Amortadiabaly praetor la Vaiable Fokurer the adelvess of “The youtable . ¥ Tho general boten Be | | § LVariable | Whae 2 -addre gs ©puatey Natale —declured Varrablo Vatlable can be got Fg), iok x7 Paint (Nd, BX) Olp:-The address of tie variable x i printiad, (V). Dati rection operator (*) : ¥DPE ts used to acco tro Value dlsved fo He Yasiable using Poinker Variable, HATHA gener fom Lt % pinka Vauable ; hae, * - indisection oprctoy Ponta yatlaHe «declared pelaker Vartable Vil. Atrow opetator( >) :- x Tt Ls wseol b0 access Fao Mombon When Skruchue Vathable 2 okefinad 29 a Pointer VaxFoole. x Tho genual dorm uu, C Expression '- x PP expression lb a Lina. comebinabfor 4 covskonbs 7 Variables 2 operators, (1 Ath mekic oxpreasinn : ¥ Pvthmokic expressions aie b formed ‘a Gonnecting Corskanks or Variables by Guithaetle operators ATLO general ferro 2 €g). e+Y , A+Z-x | yyfz, xt yf, X/LY4Z) i). Reletimal Express rey — # Relati may Cxpressims ato ber mad by gonnacking conskanbs or valables or atthmatic lexpre Sion, by yalatlmal operabor, % The general form is) combkank ey comkank Vast ble Relakioal operator * i Vastoble Expressiicn ~ expresiin Eg). AS=20 , The amwa iv bre jf pb agual to ebe tabse B¥A-B>c aed Ii). Logteat Expoossfon — ok Logical expreusions ata ferned by crunecking relatfonal expressions by hogi cc} operators. H the genera! form Ly, Ropativn af ex preasi Aogieat — Ratatinas opeatr — .xprossivn Ey, Araok 2 BASE, The ~osutd of Hus oxpressin as koue YA B greatothan Bo and BY greater than as, By ao / B25 | The vesult &% ir oxpresuien & kre iy A Ss grealey “thon 2o or B @ 2a greako har &5, Dridhuakic Expression a). Trteger expression + x DB the data type oh ra VOM abe oy he Leb hand ide op dre expression or eo [aera of tan Vartaplas cao righ hand clole hak jo, expresifin cre Ob ine type, ther expression 4s catlad fo begat expresoicn . % The geneisl forr 43, Ee Rok Vol = Bok Vord auiiamabic, «ink Vals oitomebic opaakey Operaubor... | whee, drt - datatype. Vos! Yar... = vauobles | ouitamstit operator — fF ,—, 1, for * |: Mh a ; Bink br 1S. ,e rl Arbte o|ps) Tee Value af a b 38 (i), Road expressim — OL dhe : Jon. the Eibiea’ rhe. data. type of Ha Vastable dat Aide of tte ex prastion and ongpe Of the Vottables om the bond righ pra y fea Lepressim exo. drole expression ty ited oy float Asype., thon OR Pra Lain . Float Vout = float Vora aridhmatic © Patalor ~Yloak VaKS atime | were, dak - datatype » Var), vate... aitoneki cS OP erator _ tye eg), Sloat a; float 6b = 15.5, erla.s. | Arzb+e; (OPS) the Value of a ta’ 38,0 j). Mixed Moda Expression TL He data type % the voufable on He Ape hand Aide th. expreeion and cha |datatype cf dhe Yaulable, on the wight hand aide. lof He expression aro % Aik, arent types , tron rHot expresiin ts collect mixed moole. -expresiten, datatype Vaal = dake typo Vara asttimatlic — glabadype vale: Operator eolae , datatype - nt or float or double eke Val vara... — Vall Variablos arttuottt operator +, —, /, © A% | ’

You might also like