0% found this document useful (0 votes)
11 views

C-Programming ShortNotes

Ir iti

Uploaded by

darkykoopbolte
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

C-Programming ShortNotes

Ir iti

Uploaded by

darkykoopbolte
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

5) THPCConVcLiQn:

#C PIC^IAnning Long cOublu


NUMber doubl
unugned Unsigncci 4ong int
NÖIMOL binony (ong i t
tve no. -VC n9 Unsignec int
NOT ML int
birosy Omp Chor sh0st
) o1o 23 c0mP O 6) MaKe UIc in an c xpr essiOn,
ecimaL do as binoy
B) 23 comp t
is True
Any valu othcs than o
unaisned no NULL
Signed no Sne
Sian cxtenbion |I3) witheut por cinth csis, oniy
y/ase,
5) DJaut si ong4B/8B) Cine is aMSiaa with
int (ae/48)hoI) DOUbu (3B)
short (2B) Jloat (4B) wi thOuk PoTanthcss, els
6) For mOt spc cipicr: is aseCted with
Chors (-c) Sives
n hc
neorest
Sgnrd int (1d) Qddves Lp) Switch?
undigmd lnt (u) 8hsing (8) )ExprCsiOn must be int/hor/shoSt
Hexadecimal foTMat (x) (nt.
OY caprcASin that evaluates to

3)3n signd Hepresen. HLMove cxta Casee Adu autr stmt cOn bt in ang
O's and i's Oder Ond brcak & SPinal.
4)Stmt OUtstclu (ngt inany cau) u
l9) pring docs not car data tHP, ignGrea.

spraficT marchcd.
crro
NOTE: printj("Hy")NOt on
) EtcNAiOn only tooK RHS, Wbyeak takcs cet Jesp /8witca.
signed ’ gn CxeiOn 2)COnine takes to nCXt terahon
Unsi_nd (Condiin Chccking) OP.
2)TTun cahon TÜKe YCirC no l ShOrthand NOtahOn:
VopCxp)
Vop= exp = V=
13) Char i a mCUl in bitr4 tt (constanl/expr) gives ciTOT
Chor C: 9 ttLatb-2)
3)3ncrement ,decremCnt speat
wt gNe ChOacrer then itt uscol with variabu.
is 9niy
) nteaes PrOMOtiOn: WhenevY Smal
RigAt ahit > L+ by 2)
CxPrCsOn , itt Cmplidty Convot ed NOTE: 23 , (2)* - 26
t9 int(32bit3)
2's cOn (-x) -|
Always cvaluatt cxpi sirSt (SCApcive
9) p= ) -p:( becor =has hiGhC short dYuiting
I0) !0 = |
9ct pastix operCuos COmcs intG
4sect o4tr scquNu point (; 2 I1)
expi? exp2: p3, y cxpl
Cxp2 t9 prcUdence then Sve Jrom
elsee exp3
Convest nutd ttr noTy OPeraror Cnto leyt to ight.
i4elac then slve.
" a?b:cld:c abCidic
4a ) DCciasatíOn; int b);
int mul Cinta,int
oY Únt mullint, );
G m l lint, int):
By dyatupc omul
is int
Use e 2) main) Fun is net decloncd
coma Gpra t : CVouatcd 7om (e
Compiles CUssMA that fun() ç
is Valuu a cSmbintd Cxp.UsIe fu int HetUYn type. Katcr
(2=10, y-s, nty) i<=s, Í>=) n definahOnj 0ssum pion ii Cht
cuiv. t9 1s Cuiv to j2O thnng c O GthcTwse Comp'
# Prece denc Table time ersOs
OPeratOTA |ASOIa Comptlahion SyStcm :
ivity hello
0,CJ,’," ,+t, -- (PONix)L’R Aeil pre +withCocle Comale}Aems
unory ! , ,t, *,2,sige ASsemser
Avithmei
|typccast , +t - - (Pyix) R2
diu in memoy
Alinktrt Rusca Qbu Gajec
CScu Cbinoy co)
"Linkes is a manual task. Jt by
dyault tinks JIqUiYe fres tiia
Relahoncl Printg'.
<,<=, >, 7= LR |oHtadcr iu stcioh Ony Contains
LR dce oraion buidin funhSrl.
Bitwije "0 Jilu contains dyinihon.
Jt wll Complu beco
PnngL); Comoiler wtl CsUmL
type uwich cYt.
Legical
| LRNOTE: filel Thee a diles cont
Tenory 2: |R’2 moinc) moint) be mersea as a
ASAi^Amert t*,-=)*, ,=) Prg Yam cant
hCN 2 mmain (uncin.
RL NOTE main ( )
int a; NO CSY Y
Coma
intbi7
ombiguous f) * DcAaIation: nceded bs Comotlec
NOTE: &: f)t ál) u
in ang
! AO Con be e val uatcd fined. int tun) cHern int fun);
sequenca, rder A ngt
ínt
int dun cÁpriNt l"Hy");4
lO(aL as extern lways point
Stodk to s0baL vaiablu.
) Stahc : Compiu tim alOCChOn Heop Storae 8tahc dnitiCize:0
2)siaK: Runtimu alOcahôn (AchVaHoh | AV aulCbe t9 LinKer
YCOT)
DHOp&RUntimu alloc using mauc) Vor/fu is declorcd but nOt
deyineal , t will hOVe tinKer (YYGr Cnty
"ut
* FUncion paramtr Cant be static
: CCn &e Voriablu (Compi time
oAJehime : is voriabu in måmoy NOTE: Cxtern int a, 2 nG error
)Auts 8torage Clas: extern int a,
" Storoe: Stac "SCOpe i:within bO Cl0bly we Cant have any s t t
*
"kifehim : cnol blu 9the than oleuor ciên A
inta; inittau3ahon voi ades.
int i= I0;
" not ONoilablu t9 einkr. (-S: <- ompiu tinme c s s
NOTE Quto 4 HSisRr OÝ Clwys wseol ## Poirtes
with l9Cal van . J4 usec with Value
1) 3nitiaigd
global var then compilahn entr.|2)int* p =
withh gar bag
cnt *p
2) RC_istty sOTage lOs: 3) We cant kavc cdcTes & Consta,
" Wbing it we eCemmcnd compiler to
Keep it in HCHstcr Posible.
|) AlL petnter siz is 3amu lB
deyault B3).
3) Stah stos age clas:
" NOF ONail0blu’ Arayi
t9 tinker
" SusPe: within bl0cc accesea
;Aiqeimu : cnd pram ouKicu fu hor arY ES)*'a,'byl a, b, \e, lo,)o
btahc int a; CAccutca nly Onc.
NOTE: GbuCanvatt d ason intialiged to a Wa,bd,lo
be usCd 9ther ftes 3) Chay axr C5]z àbcd; lab.C.a
Chor cNY(47"abc d"
) ExteTn torOSL Lass
oUsea to ees gl0baL voT Yfunchons 4) Chor asray ending with N l 1o
in sam aile oß othes. is treat cd Cis stng
5)int aYt]-a','5,'y: Il aYl3J
Jt tews Compiles "Dont wos, VÛriabe (nt ay[3-"abl", /aY[4]
"Functions cu by cleault exttyn.
NOTE: Fu ancant be dej'ncd insid bl0CK"
b dedared
6) cnt arCJ; 12) PUSSinS Cosay as paranmurt
Eithtr Provicu dimeniOn G7 dedorooh mainl)
Rtrt L(S): fun Lint t a) Senitrray
) Aray namu Cant bt USed n LHS funlint al])one
= fun(a);} funlint alis]) on
8) 813co() cocs nôt cradUase exprOSiOn onty base acdsess u pscd. isrord
siALeLitt) +iwill not incrncrt. 3) Chor ay[5], scanl",Ürs1);
Jt tçu sie in Bytcs. Enter 4 hos Cus o wil put 'l0'UoS
9) POintcYA 0u incrcment¡ by thu si3 at end. st wL entr s choT ,it moy
(Cad tG
strltn): COunt ng. CAos Cxupt lo
cturns
Jt AetuYns unigned int.
J) int a Cio a point to iYSH strlenl"Hlo)
ele at01.
2)a dOeA ng have box se it (0nt9tmp) Cômpes CAo by ChOs
lbc LHS
n LHS CUsi §nmet. Stronp K1, 62) I 941>62 ad>abc
3) x= B1 B2 B By

P con be Usea cs )srcpy(s1,62) Copies s1 to s1 4 Kcin)


P |osI bigc MUst bt big enyL Ohcvuis
-5) wktn VClue is Jetched.rom ttt t uil leod t s6gmentahin Jaut
Cndan, itt {irát evOsca kyte wuc NOTE CaCs]= staj - «(ats)
then onvotca t deimal.
*p: addre
Pring (" /5, ): deáma **p: int
-6) ai] =*(ati)
&ali]- (ati)
- int alsJ; uc Pointts t cnire aso4
Qt I0 Valid
(at l0) GHoy ecol to Runtime errOSn DCTay, CI3, *)2 wil
Sive inE est ae will vc addt
"IKKsi Gngon Ke 3)arii CjJ=**ati) ti) - ati) Ci!
"H" ivaic
8) Cho CC3 int ** ptt ; int ac23C37
-’csCt| Vaidd as

9) Chan c= Hl<String Cons tar


st wll give wCTning
Jt connot be mocifel
n RoHN)yPantcr to an cray :
int (kp) [5);
PointtT tto arsay, (harY rI)
&aTs s Ponttr P s POinsng t9 anasray
wil sip ente arsOy.
I) Psing(8"; accr); St wil prínt Jrom
adre to \0' chora ctes 1
2)Arithnmettc on peintes cepends ony ) PI is a pOinteI te an int
P n t ) Cray Of s3e 3 (hen * PI Ús an
Un LHS (ie type int ¥ay 3e 3.
3) int a(sJ[6J
int **P (+P)6J 3
*,)30QTTaY s
in ats] , int *p T0 ^t int w
4) Anray Polnters int * atr Cs] y nt Cl2JC3J[41 sizeG7
5) oor ta[aJ" Hì", a potntt o 20 Cray
String UtYals pointts to ID avs Qu
arJ[23='X < onValid in sàh CTcaaIa -
NOTE: nt *p0 is Vald lnt
O '\0' NULL
6) 2D aTray 1)Yaic Ovithmeties n poi ntes :
Pr3, p-3, p- P2, Pi4= Pa, 22

) Pasing 20 anay t9 a jun: |2) dnvalid operahons On pointcrs?


zdunlint (p) l6J) Pt P2 P*P, Pi/Pa P ' P2
main) typc
(nt acsJl6 J: odun lint aS)T6T) ) veid potnter an hold any
ypecast.
9A addrs uithOu typRCast
,funla); junlint atjl6]) Can't *p withou
Crsay ia 9 NemNuaturt Ponter
8) fiur olimnbiOn in dimensiSru au LI Cray
prional CAt al * POintt t9 tuvning
impôTtant. () dunhom Te
9) int alsic6J ; int (*p) [6] - a:'a.
" Sdentig dantijier, Keep g9ing
P Con be l

lo) Pointcr to 20 aTQy:


int atY L3J4J; |5) Ponter to duni
int Gunint ) main ()
to jun
P Can be s a as dun t. PS)
n Cs D9intcr 'p' &t Cancls COch thc6) malloc
&*(pt) pt *L LP) P |o mall0CLIo) alscates l0B memty un
heap and scturns vid ponttr.
12) int Gys C23C2J

’ I6B
cast.
(slz Pointes Naki suT ts test thi
SiCA (ONtO) ’8B mmall9c makes a ysttm Cl
’Dia<LNCL bectwcen tws pointcIs frCel Ch) ’ ts ree Cllscatcl memog
allocattd
Pr 4 P2 mUst pi nt to emnts ch is stay h'ny Calor
will geve erroY.
Pa- P = free (ch) ’EnUr CA Heap
ndt sl3-0)
8) Dangng Pointe Y psintt frced.
te memoY6) stUG std (3)3
tha hs al Ode beCn
3 a ptbim tt deeercol (*P)
CRUntinme este)
9) Menoy lok is memy wich hasnt |mainc JuntstiucF stuod t)
bcen trced a theu s no way t
HeTe t is a (oCol
lo) Char C: sCon(" As", c); CYor
Cs memoy is not rCServed fos Jun s); au copied to t.
8stng" 3) Pinter t9 strUctUnei
NOTE: EOF End jeu (spci al sHmbl u std * pty =
dyind ên atd)
) acTo3: #din pluus
ne semices o) *pts)r =5 S
Evtrywhere replaca pluslx)
plus by tan
| has fhigher prtacna.
Cômputai on, simpy replaCL
1)C porammin8 uses Gmly cal by valuNOTE: Btoten (" HeeCs") s
(never cal bg ycrtna). MHeLO" ClGCaecl in 3taie a a
) Stotíc SAPing C uscs u CBydeoul then basi addr & given to sun
se GLObae vnsi able |2) COPying One strut to anathes
done Cat cOmpile time.
-3 DyNamic scoeng
use PreviOUs. dun ariabu
don at unhme
#Strutuse elmernt b lunt.
) dtruCt Xy3 3()>niceon Cant dS (X=-) ’ERROR
is mUst
2) typedey unsignd Chor XH•; 4) Stoan8stsuct Gn memy alignment
Avanabl is stUrecl ony at places
typtdey is usco ts givL nomu tS Custom whe starin Cdor is b size
tyPCs.
Statt with si3e e i98Cat voTiQEu.
) typccdy stu (stuc)
Sname a opti8na4 4shost tnt a[S];
tong b;
F4)strut
daia type <
stdB int ;
stsuct std (6)= I0, S04 eHemy dara yp
1 Rsunt o pointer alscad 16) 8ts uct s n agned
S) Array suetuses:
8truct Std sLI0T; |I) B dyaur struer aindl
dOr optim(3aton.
V DyOamic nemorY CeloCarian:
J) C d not sUppUTt Chaïning auocaior Cut Untime.
per atso.
|3) Alicsing: ituaHon whve samu
memoy LOCCron Can bC accescd
> (l0<-)<-| Using did&ercnt names.
to ntgh main) lint *a int*b)
2) ngintk recursicn t Kecp calling d int c:S,
>Unin: |)Aembler uscs L9Cahn count r to
HenorH is shasCd bluw Vaxiabl s.
RejcTen count is Usea by garbage
Variable Coucctor t clcos memosy whOsL

"USed to assign ncmcA to inegeYá.


num wck Hon, TUC Y; 1enum wcektHo tbfcct code.
num weeK W TUe ;
prng "d", w); /I
w dG ng prOVidu vale, by cejutt
Volu is assigned starting qrem o.
Cnum wCeK NOn =1, TUe, wed -0,Th 03;
" Un asi_ncd nams gus valu previbwtI.
" Yale asianed is 9mu int constant
" Al enum consrans must bc unie
in thcir 3cpe.

Cnum 5kai x in somu 308pe. ERROR


J GaOaL structurd prframming lang
Jrom PrOYam ttxt CÔNtsL pases
I Cnst t9 Gngther scuentialy.
2) ADTCAbstract data tyPe) de<iU only
wAat OPCT aionD ae to be perforMd
ngt Aow itt impumented.
osupportr niy opesaions whiaY defincd.
3)AbAHract ccas hCs ast fun undeincd
T9 inltantíatt,wt ntd to cstOr SUbCa
dyin dun thtn instantat c.

COce.
S) Dynamc data struchure that chonsu
Memory U allOCatd at unHme.
6) [n taic data srUct, sie is tixcd

You might also like