0 ratings0% found this document useful (0 votes) 45 views15 pagesC Language 1
Hand written notes of c language
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
H tistrcally tore oe 2 tes ms
@ Fird Lrogram Comfuctes
Deets beans
Otel Cape Corin = Bae Fant finchons :
Hy cellt!! Le pps, ae
> Gobelins
(3) Str Computer - Thre Cam be ha ws
. Sr asin am aes ee
Peden Compactor +95 18 @ based soneglt , =
ee ae tee ee ee
Same memory.
inta 21s
int b= 15
Sum ath = IS + 15230
CPU > St defines 28 st 1a am chebile wacuit sed abot
te “snirocln of Comates pop. aI fos mopar thowe Unit — fig 2 2
Ocu @ALv @ Vonisdy of spinors
(i) co 9 AW He processo4 control signals .t diseds alll input
aa mitt fect, fog Be code for htadion Oo oO
tow data moles the system -
(i) AL —> Pe asthrmetec Logical init 1 & past of CH? Be handles
all the Calulation the C/U mug ited »
eg Aion, sbabracon Bt fexform ital operation (and ty 0) ed
its ee a
x of Pesistois =
O Gonarall Carface of Ripintera > Store Limpory date gp eax, ebx
oan Registers > Hal mmoty Beyrmtrd addaenaes gr rds «
Shick Points Registers Manage Stak fos function Gl Y °Sf, chp
D Instruction fountes Repaer=> fants 4 tert snatiudion q -» CIP
Bags Migiries = Hols plays ke Zero tnd (erty
Cis tants eee Se oy sto.
t Kegestes Control sebtings 9 40,43.
2 B-A
@ Vector Regintes > Horde Parallel (SI /mp) porations GY Xmm0.
id Pespose, Proredinal high Sete popramning
ieee : Yai ue eerie oe
ee
(jana dat ot doa OP ET
(i) dow lel Memory oxc0sg
(naar pat@ int moinC )
@ fs oye boy
© Print § (Coding) | — (Srtment)
— (body)
ee Ube et carer | ae eee
© Al Nines that ssost with (41) lastg 282 proceed by the pra-Pretse
Which 3 a program snvollse by the Lompiler .
* Re -k pes 00 alld byador piles in ¢.
Some header piles ase 3
O Stlep. 4 —> That defines sewral ual mirsos.
D Shulint. 4 —> bcont wiih integers type .
Q) SHlio.h —> Gore Infect and Output functidm .
O String. Wne stars Aandling function
@ rele —anicle tales a eae
(3) lint main —> 3¢ 13 the rend past of ¢ programy 10 declsae te madin
function. Ht ia a paint Ja C (nr and exrtocastion Appizlly
ies a poae Leg Oe, a ‘@) Print 4 (” J eee ne
® Complies im C, Setemunt 16 sesmiratirg ‘ y) Bm (alon,
lak. use. prindes famution do tity "ito uot
© The Last of amy c function 15 the written shtomert sifers to the,
Wsctiem value from a fumction.
+ Uses of CoH :
O Mogos pasts gf Ulindawls , Uinaxe amd obhes oprading Systnms ans
asttten am C- :
QC 1s used 40 wncte deinen propams for davies Sike Tables , paintos
ch.
B Lampuage i used 0 pogrom embedded systems whern pregioms rtd
2 ain aster Ln Sims armory (rictount, Comtds ete).
@ Cus used doselyp games, om wea where Latency ta Wey import
© Computer fas 40 teact quarkly on user Input
a Vosinbles > A vercable ts a Contuines ui stor0s a Vallua 0’
& Constamt.
OR.
Variables ase te Cat te Mee Cede tot proytam Cin easily
Mantplate - 4 inal fas Spouifiz thot
abuts thet the timo cam bel.
2 A=3; Ma 4s assined "5S
‘ M44; 75% tage 1
Co Ri We asstyntd AY
* Kalbe fox taming Vasiables in C2
O East dhasacts be an abbhabet on Undosscore (—)
@ No Commas "blanks, alloted - GA Vooiable name mustnet
@ Mo speurll symbol thos tan (—)alloue! "i Og Keyuiots
@ variable rumes ane Cane sensitive .a Sager ©
¥* CO Vasiable Singh V
ape ete coe lis
Int a = 105
dos a = [ioo];
et ic type » Veni, Van?) vani 3
Tusa ann 3 erect dlifning 0 Vosiahle : ie
© Vauiable docleration
O Vbaarble Definition > i 1 |
@ Vasiable Initialization .
+ Veaicble doclration» In 6, H Hells compilea obout we existine ¥
ble with the elon mame and doe oo :
tan he nile 1b declan tnd bond patie
and anti tl be ald tinal of iiteligation Y
‘en
“bl nation =? The Compelen allocates ‘Some memory tnd valoe + it
6 Vialable inchialigakion 2 Yt 13 0 vasiable tn He process whore te
Se eee aa
int min £ )
Car name [ too} /
Buby ( “enter yous nme )y
Samp (45%, rama") j
Printy ("Yous name, rame),;
heturm 0 5
5+ Consort > A Constant is an entity tat cbeamat was nie
te extiy mrcape, ange wee Insibl
pee :
Corstort Js. incteges , Real) Chasactos .
BSecondiay — AAary » indi sbuukuas, Union.
REE na mi ay rn 8
Tegra ane 32 Keyuiorch anaclable in C-
Hh
dude | duble tnt Abul |
baoak Ang che Buutd_|
oe seluam |. enum | typedyf
ag Liguictes Cute mine |
[omar | show fibs’____\unsigpad.
‘Anat tintel Aly : f1 Vas
se ear’
ape Hie | —— F
duos Wht ase differnt Aypes AP operate and expaession 7
> O Aitimetic. oab9a +, -) *
O Relational yosohs ><, 27a
Oo ‘ L operas > O Amd 3
@ or Ij
@ Aet — |! i ¢ atolio- h>
Oe
Tink a 40;
int be;
int Sumo B ‘
Dinky (“Eten the. post mumber™);
Sang (“4g 3)
Brindf ( Eqston the second rumbor™) ;
Seanf ("4d 084);
Sum = ath
Bint (Sum of dso rumbiis 1d Sum);
Bunt (4d [a>, a>b);
Fonty (“d\n 0 €4);
Retusm 0 5
WH Logical gporebss > :
@ And - ¥ both te ohoatrs a2 20n 220 , Ahem londktion become
tun -
int 245 2205, X
Int bois yb 2 IS,
@ Ok H any of the tdo- qporcbs» ase ton 2080, Hen london
Leiome Pus.
ONat :— $12 Used 4 reverse se Aogial st .
TeF
ber
wyBiogpdes > He imdbuda < stdio-h> ager é
Int arain ( )
Int aes 5
int b 2105
Geet ¢ (a 84)
ee Tua \n"),’
Geet 9 f 18)
P print (“line 2; ond” 48 Tue \n");
Int a 20;
tnt b= 10;
Gam ¥(o ss)
P printy (“line dj Cond” ts Buen");
Gao ele
7 privy (tine 3 § Cond” somtTue \™”),)
3
Gana (a J
f pntey (“bine ¥ * Cond? 33 Du”);
x
fctuan 0 5
% chee Y Cause» Inbtoadd of Using multe Yf shtomonds, We cam also
vse else f along bath f ds forming Om if - else if - che Sadoles .
Pep ee ifr tae Atduass Sidon | Hs te os eecuted only
. chee is optional i pe ao Siete nly a
* Also, tune Qin be Ome ron ob Clac ip” —“onaciona fail.ee eee ore
[Baa IRB, ao tejney any oy fo
2nd! et © The lit sucle of ta ws
‘4 a Operation ig the \briable and Ae
Cae EY) ih aide value.
Co | 98 | + The Walt on He Sipht aide mat be
2% I Ff some date type 28 thay Ipt aide
p 8% | = | cthomaise the Congpilbr will Anise exer .
Differort types Assiyment asa :
O=
Qt= + Mb oferty Aorbiration of + ard
Valu
orata first odd the
ink main ( )
le
det ;
trunctp (“Enter He pret rumnber) }
seang (“Yd~, BA);
Primes (“Grtos the suond number);
Stang (“xd ~, By);
Aetusm 0;
jQi me ae inibade << asbliowh>
4 ink grain ( )
z
¥ (x >y)
a (a pos san
eer a)
j
Gn by
. i Tats qoratos dustments te valu Y
ee ea
> Trerkmert tnd decrimant ase fpiyeintly used «
ley who taste ofpfliation tn the troversal of salty anf potrter
Beaytam = Ht indude. < sitio. hd
hd train ()
int a25, belo; CIS) d= lO;
Pit § (“a etd a);
meeEH Conditional operabia Lage oy
A Bhort hand "if - else cay be cansten Wing te conditional 0% davary
Condition? expecssion- if - true ; expacasion- if False
spt
+ St is used 4 assyn a \plue Xa Vasuable ing on the
jesilt of th Grinsl expesies: a
* The Syrobx of Conditional of tesmaay qfoucbs in shied a3 felious *
Sk cheraites on 3 Valuts Hat's why dt is abled Ternary gious -
+ Tie operets Can hulp programmers in poformirg simple .
7 Bil wise qpoutors — Callous you to Maniplte das itins of
foul. ost of the fprebes we ward dn ebubaad etn
© Bitusisn And qporcta La] The afput yy bitwise (Ind) is 1
bs ing its of 110 glertnds in 2. eihes bit of an
ant 48 0" then jhe sesult gf Conseafonding bct 42 exnbuoce coNed Binaay Conuession falls :- fags ria,
© Diwide the decimal number by 2
© Wacte dawn #0 Homaindes (0 oF |).
@ Dirwcle the guatitnt by 2 and bute dauln the abmtsndes
© Repeat until the puotiont becomos O -
OTe bi no. is He Abmbindans Abad im suitase orden
(paam bottom t 2p).
€g9 J2--2 =6, atmoindes= 0
6222 3B, Avmaindes 20 12 = loo.
3+ 2 =), Adminds>!
122 =O , Aumoints=/_
8) Bintay Arcthmetre. Rule
Addition : Dehlon *
Deore =0 Grubipedatin :
O=
ot1 =) 1x0 =
1+ 12/0 (casey 1 to the next Column) Ixt
@ Subtraction + © Diwiston + Smiles
0-0 =0 devel guntisc lag
te One! Aipeated Bubbaction .
1-120
0-1 > borrow prom te ment bet
bug Bit And Operation Of 12 and 257
° 100(n D)
og ooo y10 0 Sn fina Ge)
0 000100) (In deimal 8)
Bray > 1 Inclicde « Stlio-s >
Void maln () 1+ Ouppedt wif display 03. +
Cee eas: duiput > B
el@ Bitwwiae op operator CI) 2 The outpect of petwise OR mye
feast ona Cosscsponding bit Y tubo operands im 1. In C
Popamming bituuise Of operatay 18 donolad by |.
buon Bitwwise Of qhoratban of 12 and 252
nce 0000110 0 Winasy 2)
ok ee)
OooO0OI1llIO|
Progsam > H Indude ¢ stdio-n>
Vaid ain (> “Ouch Wilf despa:
Output = 24
Int 0=12,b = 25)
print (“Output = +d, of) )}
J
@ Bebusise XOR i The result of bituse XOR oferados in|. 9p he
Aorstipondling bits Y 2 qorands ase opposite. J+ 12 denated by *.
ei Bctuuse XOR operation of 12 and 157
0000 100 [3m d bina, 12)
A 000 1100) Cm binaoy 25]
00010167
Chogaam = + Inchude ( skbir hd
Vad matn ( )
: ale lip ify a:
Int a= (2,2 25; bp 21
Pent (“ductor = 74~, 0°);© Bitrise Complement pews I ts an aporstr (Works 3
Only one gprand) Ut changes 1 400 and O to | -
at is demokd by ~.
buss Bitwuian Lomplement operation wf Integer 357
— 3452 00)000/1 [In Birasy)
Toolooon
TTO1! 100 = 220(3n deanah)
but ste. bitorise Complement of 85(-35) i ~36 becaua2 for
ang integer n, bituise Compliment of 2 will be Coe {Ae 3)
@ 2'8 Cmploraint :- Leto Complement loa :
humbirs . The 23 lomplommt of me. pg err ag
Hat rumber plus |.
G Decimal Ben 2's ”
° boeken (111110 +1) = ~90000000 = -0 (deamal)
! 0000000) = (initio +) = -111 11 = ~ 256 (deatmas)
12 20001100 }-(i1/001 +) = -NNol00 = -2 9 (cheinel)
a Nouloo | — (deleoos +1) =~ cbloolo0 = -36 (deuinal
AGE? Bopan > +H Include ¢ stlio-h>
Vase! wasn (_)
z XN
Paint (5, Outhusts/-, -35)s;
tt§ (outputs -d, ~72) 3
OE taut = 36
Output = I)© Right steph nator sits abt btn sruande sight by xin nA
Y speupied bits .
“bt donated by >».
eg 5 Right shift operation @ 212.
= 11010100 [In Binary)
0011010) [In Bina} (hight hipt by 2 bs)
212 =
212 >> 2 =
212 524 = 0000000) (In binary)
212>>8= 00000000 (mr binoay)
= 11010100 (No ships)
220 =
@ lept shipt operates :— Stype old bits towrasda Sift by 4 (orn
20. & Speufied pits - The bit positions spat howle boom Vocated
by gh pe cloreos ave illo 0.
* Sat 4 denoted by <<,
Cg = lopt dip oporation of 212 .
212 = 1Ololoo On birasy)
Dave Te 110101000 (3n byrasy) (lyr shift by | bit)
212 << 0= IMololoo (eft by 0)
212 <¢ 4 = /1010@1000000(Iy Beray)
Progam > + Jnduda Cstalo .4)
Void main ( )
num = 212 5
fos (120, i<=25 ++i)
briny (hight shige by 7-d = 7 d\n) 1, mm?
fiery (WY;
Fo (j20; feo; ++I)
pend “ig shift by dh > Ld \ 0, 1 ramme C21)