Gate C Notes
Gate C Notes
Stqn
Eq:- 124, 345,0, +52, -327857
Cnval:
Space, Coma sumbolA
1 00 277
23 356
RS. 458
852
octal starts with 0 using
diqtt o t 4
Eq 056, 0246
hexadecimal starlina with ox
or OX
ustng the digts
o t and OA toF
Real constant
E x c p o n e r i t t a l
(e o y E)
actomal
345-23 E -4
234. 456 e c p o n e r t t a l
poLt
man ttssa
f r a t o n a l
decbna
past
Part
rt
25 X
10
345
Specifiex.
int main C)
Sloat x,9,7;
=12615 34;
y= 145.G58E-2
ty
pntf(", );
print("e,z);
vetwn 0
12676 968 75
264680et004
left to atgnt
evaluatiom)
&
Comma perator
In a
statement tke
X0+90;
ray be evaluated
OY Vtce Versa
bejore q
ype
d a b a t y p e
loatt pt data
poimau type
char data type
C supported
usey-defened
empy data yes Structuses,\
(Void) Untons
derived
aYous, poùnters
stbyas)
Symbol
chara cter
ettes
digtt
Mumbey
inteqes -I,+273,
sttng "qate"
nt 20.45
prsint Fl,);
when I am unytng his
this on online
COmptleS even wtthout anu
epAeci ype Convers ton i get
=20How?
Here int and fbat have the same
size and theve ts no
expkctt ype
cas&ng dequised fov such compilers.
unay tncTement
Pepast
att
Tenay opealor
?: (3opevands)
If s true, t goes ts y, xy
Tf is false, tt qoes to , X= 7
declasaltom
mo memoy is CYeated
and only type s infomec
to the Comptle
ALL
ALL declaralions ase deleted at vun tEme
by
by the compiles. Declaratons axe not vequlrec
at un me
int
xts qlob
xtakes o as the deault.
tnt
i s ocal
x takes qarage value by desault
mtX=20.42
2bytes compilallon esoY
intx-int)20-4R;
not
Possible)
expkict tupe-caslüng
bu
J.
implictt
20 (tuncation)
type-casing
integes+ tntegeY ntegey
tnteger + loat Aoat
implicit
int eqer x loat loat J
shot = 32161;
= *+\
bytes
pabk , D;
Op -32168
int Cnrt , tt y
int loat y.
=0
Ep= 75,
X-y? w?r:p
3
else
E E2
execulion o E2 depends m
E
X=2 ?
3:6? 8: 4
X=
(223 :
(6? 8:2))
not
ue executed
X=3/
a- bg c? d:e: f?9:b
a 7Cc2d:e): (f 19:h))
/
tue
alse
ISbts u 2 will be
executed.
-( 2,3) E)
3
=, 2,3
= has htghes
pveference than
nt X-T=2
ae Constdexed
here y, z
eso on)
comptlalion)
to be not declase.
int y,
tntt x=Y=3
n =2;
pstf(gate")
printS("exam");
p:oateexam
pintfCgate-14,1d,1d, 2,3,4);
D gale = 2,3, 4
order o
pa.ssi Voalues
CS mot
i=y=-3
Knowm
3j
9z
- = X=3;
+=, = *=
z =3
tnt , 2,
= 0
3
Z=4)
Ak 5 l5
23 k 0
0 ollo0
Loaical AND
9Aogical oR
Short circuits
use C now
and tncement just after
thts stalementt.
J-t+3X (x++)
3x2 y= 3x3 y= 4x3
6 |2
a= 2 X4 -4 =
4
a-4, X=3, y=4, R=5
Statemenls
acoo
dedaxalion statements
2 evession
scanScans.d, ) call by address
patntf(".d",
* l by
Call by valul
value
Call by addreSS
Lnt int c
= pont ( ) ;
=potntf( ");
holds O
holdsi
tntC
x=patntf ("--");
spaces
holds 3
tmt a- 25
pvint (a< 10 ?snall:
"qreatt
9 eat
int a-25;
Pointf ("d, a<10? 20:30);
vetuan 0
930
Polt("gate exam);
Qateexam
paitCgateexai)
op qateexam
x=pintf C1a", pintf(gate-4 pantf(«))=
pattF(',
Op Cgate=1G|
it,9,3
= SCanf Cd1d", &ac,&y);
pnt5 (p&", z);
int
Scam (a",);
No compiaWon en0T
Seqmentaim Jaut(un tme cuy)
Votd main ()
t , ji
uhtle (to)
3
Op0,16
nt =3,
do
pivt(, );
3whtle (cio) thEstRs semicolon
thesemicolm
ts end o
do-uwhtle
int X-3;
do
pstnt(.d, x);
p NothEng
tnstntte Koop
sy desault assumed as
TRUE
Statenments
o.);
0
3
$3
int i
JUr (t-0 iL5, i=it+)
pointfd" i);
p0 2 3 4
alse
for (0; 0,o)
pit fCgat);
pzit5 ("exami);
p: exam
Ju
Sos (1 ; 1)
paintfC'30te);
J
pwitexam);
pIvftntte tmes qate ull be painted
int X=\,
false
Jor(X-0 K-o; X=0)
poirtS Cgate);
oNothg
fos (tvt jso; jew 3; j++)
Cj4)
potntS("&,j):
O
p 2 3 56 8
goto abc
abe
pabt(xy); tn he
Sae Jm
umcmdiEonal jummp
unctiomS
Svmoduaily
Yeadalsilutg, Small
unslandable, se-usable
Uncon
Atvaryfumellons
use dehined
(pe-detned) un cltons
ExPaintf
potnt, scant,
prototy pes available tn stdio.hb
deftnilions avai lable in
dunamic Acbra
Ainked Xbrarte sS
unclton mame
Juunclion axquments (name, tupe)
etum type
pintfCgate)
3 J
Void matn)
Void f)
pontCgate) 3
Junctons
with/wtthout
wtthui thout xqumenlS
setun Value
Addillon o nuumbers
with et
wtthout wthout
wtthoutset wtth arq
wtthout axq with asq with vet
without aq
without
axq and
withoutetum Value
Void sum)
tnt
point ("enter 2 numbers"
Scanf(1 , *x, *y
pintSum=1d, xty);
Void maln()
sumC);
pintssum= d, Xty);
Votcl main )
nt a, b
paint ("entr mumbens);R
t
X= 10, y= 20
xetuan(tY)
3
Vodl mainC)
pintf C"d', sum());
setumxy)
Votd matnC)
int a-20, b= 30
tnt C
C= Sum(á, b)
aeJoYmal axqumenls
3 Clocal)
matn )
tnt a,b
ab axe
cla,b) actual
ayquments
calle
OS Votd main)
int a-10, b=20
b20
Sa b);
At
Atun TEme, execulim beains fiom
votdmain().
Compile tme tt compiles Jrom the
baqimiymg
(*p) + (*4)
pointSC1, );
Votd main()
tnt a =10, b-20
a1 OOO
&(ka ,xb);
20
I004-
to
Ps potntna to and 9, cs potnttq to b.
tnt
vetum (y+);
3
Votd atnC)
xF(x+);
inta (*4, x);
Op 202
t f ( t (nt J)
oetum CJ+t);
3
Void main C)
int C=10
y-f(xt+)
paent5(x= 14A,y-td, x,9);
3
olg
Op X= 11, y= 10
tnt S(tnt y)
vetun (t+g);
Void main )
int-aJ=20
)
pakntF Cd, 1d", x,y);
10, 12
evey Junctton is an tdeniJier
Yame
StovageClassesS
Vaiable Funclioom
nome S the
mome aiven Lo
Vauabe
tne memOs
Yame qiven
to the memoy ocalLin at
localim un-Wme,
at un-lUme
9Mobal by default t
ocal sqkoba/extemal
stovage classes
A
Vstoraqe Aocatiom
Storaqe SCOpe
iTialisoalion
veqiatermatn
/mem0sU
dusaticm / aCcesSS defaut
Vistbilt Cnttta
extem
auuto 3eqisley
static
auto
auto
declaxalion
L Aocal vasualwthtn block| unctton
matnC)
bnt
t a u t o tt ;
int y; //auto tnt y
X=10, y= 20
pnintS("d,|.d", x, y);
int =20
ptntfd, <);
Point S(d", x);
3 2000
z[iol1om
stack
scope/vstbelty accesstbility
Rimtted ts block
3 default tnital alue
gavbage
stosageXocalton stack
memo place)
always
seqister Local
segtster tnt t t s used.
Jor(l-0 t<1O00 i++) dreguen
ty
eqtsler
eqtster
3statie
Can e used as Aocal qkobal
memo sy Cveatedin
data veqim
derault tnittal value zeo
stalic ont x;
Aetime t l l the end o pvam
Memoy cxeated for thRS just beore
the poogsam execu llon egins
and'stays trll the end
Proqram in the memoy whether O.
,you use it ox mot 0
SCOpe depends om decl axalton
Ent = 0
nt=
while (x4=i) while (x4 =)
tnt t-o stattc nt i=0;
0 12
Aoqically
mot poeSent
CPsoqammia, 2
data
user deked
paimttive
dei ved data
data
data
aay
potnter
StuctuYe
2. Untoym
i n t (20r4 utes)2
3. enum
2- chas( byte)
3. float(+ btes)
Covnpilex
4.
dauble(8 kytes) Compiler
compile
doesnot
Knouo therm
Knaus
them
deatved and uSer dened ae mon-pomil Eve!
o n ttype dkdata
0 n N yo n c e e
colaclton d
Samel stnilao type d data,
aCcessible utth ome
Vaialte.
memou allocated tn
Seguence (Conliguous
ManES
index egns from O
advantages fast access easy to epre Sent
dtsaduan tages s i z e ts fced
tnserltOn&
celeltom are Slod
memoy mtght 90 wasted)
data
Avay collection dhomog@neoue eements
Stpred tn memo Conltguouy
LLLI
2 3 t5 6t
4-dtmensleal)
inta8)
enqth/stze= 8 elenemls
eyles 2 t n d e L
address
ivt=2 utes
4 V a l u e
2
34
10 20 30 40 | 50 Aa= address d
000 1002 1004 I06 l008 anyasay
at0 aH At2 At 3 atf
a -D adodress
a me dL an anay-Paddjess
1St elemen
dt0 addhess d. ftst elemenit recdence
= k a [0J = 4(aLol)
= k(%(a10))
a[ = ¥(ati)
TmpaC3j-X(at3) = x(o0013)
Potynter ts
(100.+3 x sxe
d nt)
a vaviable that X(1060 +6)=
holds the
=
*(100¬)
= 40
address kao= at0
kai)= at
a[o= x(ato) =
Value at (ato)
pointe &aL=ati
ts a= address d-
Vajiable aCJ= x(a+i) st elemert
that
holds the a-pointey the
to the irst element d-
aar
a c d d r e s s
Vauabe
tnclude <stdio.h> tnt-4-otes.
tnt main()
nt as]= 12,3,4, 5}
Potrtfop: ka=tpn", a, ka);
paintfaH=: kat1=#Patl, katl);
etusn 0
olp
a =
OXFFE41497 D40 ka =
0XTFFE47497D10
atl= 0X7FFE47497D44 Katl= OXTFFE4747D5t
add OX4-E
add ox4 = 20
s t x e
1oa0o ol
tnttnt]; glooal
Vold moinC)
tnt aC3)=
tnt bCtJ
{10;
0 data
Acqion
1
o stack
2
b stack
012 3
qlobaltnittial value=o
Votd matn()
ent a[3] -{1o,20,30
chos bE3] =fo
b,°c'}J
char c[3= {t,98,99
4567
tnt t tb[2]B]; 2D anay M
0 2
Repesertalon
Memony Represental+on
b D
Ow1
yte A yte
a 10 20 30
40 50 6o
a gtves the Value at addsess a
XXa
tnt bp133- {o
b 0
o00
t n t cL JLJ={,2,3,4,5,6, 7,8;
o- elements
tn gach xou)=3.
2 3
5 6
40 50 60
int a 3 [33;
intj ow by
for(t-o; l<2j it+)
Jor (j=0 j<3, j*+)
Scanf 7.d"', k a[EJLJI);
3
nt aLs];(1-0) assume int-2B
3 1-D's
9+8
int c 3 J ; 3-D
n o . d - elements
tn e a c h w
92 2-DD's
table
9
t o e no.vouwS
in each table
tobles
ID TII
tnt as]; 1-D
-1-D adra
tnt aE]; 0 2 3
paintf( d, a)
:10
a mame darnay 1D
ka addreSs dan aaybase addess
kaoJ-3first element addvess
a [D element Osname in 1D
tnt a[]= {10,20,30
a10 20 30 ut-2B(cay)
000 002 004
katl = 1000 +I
1000 +1x Slze d a50a
= 1000 + IX6= 006
atl
char b3)=
{a, \b', 'c'}; ASCIl Value
58
Mostly we use Xoops to access the elements
int mainC)
tnt a 0 1000
a[aj= 10, 20, 30 20 1002
tt 30 1004
X= atl; l 1=(b»t) (a+);
paintf (d', <);
etun o0;
Ln Some
Comptlers,
Op-1002 X=a+I
is an error.
type msmatch
iTt maln)
tnt a3) {10, 20, 30 =
tnt
= Xat1
y= X(a+1)
pint (d 1.d, x,g);
vetum 0;
3
p: I 20
name d avay
0
+O
kao] addves d
Selement
&a addsess d
asay
a[o name 0
element 0
first elenert's Value
000 1002 (004 1006 1008,
a 00 2o3o40|50 Se d
2 3 4 Lut "2Bsa
a = j000
ka =1000
at0 = 1000
kat0= lo00
t l = IO02
t2 l004 katl= 1000+ Size daxsay
=000 + 10 =
\OlO
ati= &a[oj +i (stze d element)
000 x2 1000 t2i=kal[U
kati= ka[o] +i(Stze d
anay)
1000 + ix10=1000+10t
a[o+i
= 10+
2-D arsay o t o2
ot0to3
T
a+o a 1002
a ] E
atl 1o08
a t i kaEj
at2
1022)
a
noame O aDYay.2 a addvess d
dre ss
asay
OW 2
at2- kao+Ioorw
ow3 tncremei
aLOJ Mame d-st douo addyess oo
a= 1000
10004-2(+X2) = I016
xa = \000
ati= 1000 + i(Stze o0u)
&at2 = 1000 +-2(Size d asay
10002(24)
= 048
o[LJJ a[oJ OJ =
acoJ+0
addresS d element in t oud
the avay
at0 k ato)
atoj+0 = k a[ojtOJ
itf(n,u' ka[oi) 3
4
004
006
paintf mf u", ka[0J OJ)
Point(lnu", at):
pointf("nfu', kat\); o 2
poivtf ("mtu', kagj+1)
paint ("ofu', ka[o3+);
Points ("u', apol); a [oJ= X(ato)
PaintF("n u', a[oJ+1);
aint f(ou, aoJo i) ;
pantf ("', aoico)+1);
3
1000 aH &atiJ
000
O00 apjtl=apJ
O00 a[oj+0= kapIoe
O04
008 aool x(aoj+0)
004
IO02
000
X(atjoJ
002 %(1000)
2
1D epre sent a lion
(-L+) elements
a means ooktng
or the address
TLameSAelalio addvesses
a nae d 20=ka0]- addess d
dtw 0
ka0 o) addvess d
s element
in the 1St yo
dthe aay
a= IO0o +1= 008
atoj=io00 ato]+1= 002
atojtoj= 20 aotoj+1 = 21
int a rE m= 100p
= 200
)Constant
COnstant
gen a[oJ[o] = I000
i-
attj) =? a
Size nt 2 butes
=
m-
we have to
alculate the no d
elements lotfore act in
the main Ymemdy
O00 + 1210=2210
4-,+1 'u-H
atj)= *a[kJ[LJ
Rouo Major (-4)1,+
3D epveSentaltovl eement
4 elements tn mch 1D
int arjJLA; Oeach
S in each table
2
3 tables 2 4-D S in each
2D
32-D's
3
apJ[Oy
apDY
ooL ap
aLoj aL3
elemert
table
oLO elemert
/name d)
table elernent k
Cw
tablei
elemen
i n t aLpLJ); whexe P ,Y
dmensioyms
(Sizes)
we ae ing acce SS
a
palicular element
ka[ijEjJLKJ
In table tor xow and in that
Dc 9o fvs elernent 'k'.
we have a total d
tables
Befrove th tale, we havea
total o i tables.
n each tale, we have (9,xr)elements
Before table we have a total
xaxr)elements.
table t, efoe theyow we have
j vows
oehoe the th cw d
table i, we have
Also, we will have
xj)elements.
kelemenls ore the a:jL;JLKJ n
the th oW
Total mo d elements
Jede aLJLJ[K)
= + iy+k)
in the
at+
ato atl At2 at3
ati a[j
att)= * (ati)| the
2)
q i
a m a y
a y
tn
e a c h
t h e 2 )a o Y
delements
n_the
in
d-YoOS
2D o m0
int aL3L+1;
folous
Dw mOjor
tl Order
d-mame d the 2D aay
a +o addyess d the othr0
dthe 2D aray
ati address the th sow
the 2.D aaY-
at name d thow
the th oow in
the 2D aoay
dthe 2D amay
a)++j addvess d the th eleent
in the thow Othe 20 axay
Note- a)+j =
*atJtjj
aLC) address
in
dthe ith elernent
the ith ow d the 20 aay
ACG= MOmR
OTValue theth element in
the th 3ow dthe 20 aray
a - addaess d the whota
assay
&at+= kato) + i( size
dwhola army
3D
int
ajtJA4J o d
n
elerrents
e a c h voL
ato
a+I
a[oj Coj +0
oaddvess d the oth
element tn the oth bow
doth table dh
the 3D a a
aLoJ Co)+ addresss d tth
element tn the oth xow
the oth table d
3D aay
attj+ks addvess d the kth elemat
in the th row
the tth table in the
3D a a u
I n DS a[u
t
ajLjJ
aAuE u &aLtj)=?
aLIj) -?
I n 4D: t aoj
a+l= aL) address o
kase address
elernent A
& aL)= + 1
(stze o element)
I n 2D int b[i0 203;
atl
& au) addsess d
aLJ= base add +i (stze d Tow)
In 3D: int cEioJ [20)[20];
atl= ka[i) addvess d
table A
a= base addsess +1 (Size
dtable)
Pointers pantey is a Vadable
that holds the addre
ss.
why do we use poiiterS t
C?
because Se it helps
in acce ssig
ointer is a
Vaviable the had waxe.
that centains the (for el:- main
memoy address dh memoy)
anothevaaiable. hadwase has tts address)
Advantage dunamic memoy allocaliom
for Vaables
Oser can create/delete.
Oun time
memoy memoby with the
allocated help dpointers)
dusig
Bun Ume Tunttme
memosy = heap
duamiC Ymembsu
is CYeated
when we dynamically
in an aYea allocate menoy for Vasiabes
memoau eap acts as a memoy pool
Called heap fYom which memo xy
to those Vadi ables
is allacates
Def
otnter ts a vaziable that holds the memoay
address da
vabiable/funclionarsau/structure-
etc
pointer declaxalion
int p all ave cho
Lnt P Same address c character
tntxP data
p ts a potnter vaatable
that potrts to an integer
e
e., ponter to an tnteger
(0)Lteger potnter ov)
pointes that holds&ddress aan data
integer.
P Vaouable
expression ( but mot a vaaiable)
value at p
X deveference operator
3000
int
int -10 P2000
10
2000
Note: ts a
vatble ts a vabiable |
is an inteaeY. .
bu p is pointes to an tnteqer.
or Pis
a pointer
Vasiable that
potnts to an tntege.
Ppxp
int c= 10 int=10
declaralisL-int xP = *x; intp; declaralton
and
ntttaltsalllon
P4 tnihalksalion
both ae, Same
dum)
P= , qives an enor
Lnt Lnt 20
int Xp= X; 20 1o00
2000
pt-2
pointf( d,1A, 1A,1a, 18", <p,kx, kp, Xp);
2 3 , 1000, IO00, 2000, 23
23
ntXP
chax K,
Op:2,1,4
size(*));
Xp alue at p
int X= 10
int p x10
lodo
2000
int =10
itxp=*;
int X; n nteger data mosL
int Xp imp
Pladdress tegex
data
P is tnteqes pointey
iss pointer to an integes
holds the address d an inteqer vaable
Oy data
Pis a vVaaiable that holds the address
dan integer vasiable data:
bpe dvaaiale p(wch is
deaived
data type)
int x=10
int ¥p= k
Xp=20 420
OUD
p = X(T);| PLoco
2000
¥p = x j
2.0 20
iTt a5- 10,20, 30, 10, 50j
tmt tnt-2B
P-a p= kaLo];
paltf "d,hd, p], a3);
psimtf("a,1d', x(pt), x(a+1));
patot5(4.48d", sLp), ial);
a 10 20 30 40 5
ODO lo02 l0t+ 1006 1008
Pap=katoj\
20 20
20, 20
20, 20
602 PLJ= %(pt)
X(1o00+1)
=(l002)
= 20
ptf(a", pL4));
p:10
arvay VS poimteY pvey example)
P=&a
P
include<stdto.h
tnt main)
lint al5) =
$1o , 20, 30, 40 50j
tntP
P=a; p=*aD];
patntf("hd,d" PEA3, al41)
paintf ("|p hd, }.a", x(pt1), X(at1))
poimtF(" n.d,1d, ALp), 1 ta);
Pt 1;
2 0 , 20, 20
20, 20
20, 20
30, 2.0, 10
iantP tnt
X= 10 (Vs) tnt Xp
P-
XP=10
Pgaobage
ue have )gavbage
By default,
a gasbage value
2 Pgabage
XCgar bage) P lo0o
= 10 ?
Seqmentatiom
fault
If we wuant to
We call this as use pointer
awtld potntes/ bad potnter Vauiable popealy,
uniniliaised potntex put addess tn
the' p'frst
t n t Xp: / p is
lnteger ponter-> vefas,
an
int ;
to
addresSS
|/ x ts an integer
Chas C; / c is a chavacterVaaiableRefers
data'
Vasiable data
to
chax x//q, ts a chavacter pontersefer_ data
to
float f; fts a float vaviable efers to
addre ss
loat x; |l ts floti ng potnter efevsto
a
data
y xefers to
P:2 efers to addre ss address
xc,f tha hold. the data
tnt 2B say)
tnt
sized() sized (tnt) SizedLlo0) =2B
= =
cha c
stze( ) sizedkCchar)
=
Size6()= 4R =
2B
loat f:
Sized Ga) Sizec}float)= Stzei(1sf)= +5
=
double da;
Stzedda)= sizedk (dauble)= stzedL(3)- 8
p 2, +, 8,1
int xp
trt 20;
P= P+
P 2000+I(Size t )
int E
2002 ad
int y-30;
P-4
=
2000-1(size d add
tot
998
PE200D P= p+ whexe
P are pointers
20
2000
add +const
4000 add -cConst
3000
P (1010 -1000) 5
2
PP+I
P=P- allowed in potnters
=p-9 Johere P,9, ae potnters|
P.9, should
be d
Same type
tnt = 20;
add-2B
i1Tt=22-B
int x
tnt - 30
P=& *y;
psint5(d,d, u,fu', cy,p.4) pt-1,
peint S"o.d, 1d, fu, fu', ,9.p.9)
20 30, 2000, 4O00
20 30, 2002,
3198
it aL5=
2,3, 4, 5j, int 2B
int
Pa[5);
nt a[0];
PairtF(Aa. p-q.-P);
p:10, -10
int *p
int= 20 add= 2B
intx Lnt= 2B
int y= 30
int a,b;
a= p-9
b= -P
point5( 4A,4a , 7a, . a , )
p1000, 1002 1,
7
>xp+t- X(p++) =
)Xp:
p-p+1;
t tT2B
int =0 10
add=2B
I000
P- ; 1000
2-000
i n t ar5] =
{10, 20, 30, 40, 50f 10O002030 40|50
tnt p- a[0] I008
nt 9-kaL4];
nt xp= a[o];
itX'= a[4i
potnt (" u, .u,d, 7d, PtH, t1,P. P-
Dp:1002,1010 4-4
int = 10;
int xp =
k*; 10O00
++P
PL1000
2000
P 1000
+tp =
++(P) E xp= Xp+I
p
int = 10,
int Xp= k ;
Cp)++ 10
000 K
P1000
(Kp)++ E
XP
2000
P 1000
Kp1
y20
(P-); 2.000
PIO0O
-*p; 3000
tii) (¥p)-;
iv -Cp)Cxp);
*p-- int and address
vi) -*p; eednot be
vit p)-- OSame size
vit--(xp);
2
*Cp- -sp)
=*p P=P-1 xp p-1
iy=)-- tv
(xp);
Xp=Xp-1; Epp-1;
p
tt = 10;
ntXp-&
As Xong,
P
as p points to ' ;
C - X-I and Xp= Xp-
a ve both Same
y --P
-p)
P=P-1
Xp= 100; t
xp =(ot *)o,
int xp =NULL it *p;
Xp= 100; lgladal
NOLL xepresemts zero. PlO
#defre NOLL O % =100
We ave
o ut y t o yg to wite, to the
Aeseteence a.
NOLLpointer, we
oth addvess d
the main mem0by
pO th address
oth
dthe RAM/main
accessible toRAM/moain memo
the user menos
.get un[Ume
is ot
tnt malnC)
Lnt pbr-= NULLint Xp=(nt
x)o;
fptr!= NULL
Prtf (Value: pd]n', ?ptr);
else
oetum 0;
when address L
an ts not assiqned
to a
pointer, (t has a antom addsessS
which can lead to
misusage
So we assign NjLL to the
So,
pointer to besafe fom
misuse
main
int=0
P AX;
i s destvoy.ed here
Xp 20;
Tuing to update Value
at valic addre ss.
is ts calle
as daqling potnter
dereterence
Danalinq poinleroccurs at the time d
the object destuel+on
when
deleted OY de-allocated. hom
the object ts
modt fytng the Value d the memo withouJt
sttl points to the
sell potnter. he pointer
deallocated memoy memoy locatiom d the