Please enable JavaScript.
Coggle requires JavaScript to display documents.
Lect 6 - Coggle Diagram
Lect 6
Comparison of pointer
Equality
point to same mem locatn
compare only wth same type
Equivalence of poiter and array
array name is the ointer point to 1st array ele. Warning: const pointer, Never change it!
Refer to array ele.
With pointers in 2 ways
ip1 <=>
a
(ip1+i) <=>
(a+i)
Wth array index a[i]
Pointers and arrays
Point to array ele int a[5]={1,2,3,4,5}; int
ip1,
ip2; ip1=&a[3];
ip2=&a[2];
printf("%d %d",
ip1,
ip2);
Arithmetic operation can be performed
Incrementation(inside array) ip1=ip1+1; ip1++; ip1+=2;
val of poiter scaed wth storage length of var
Strictly avoid step out of array
Decrementation: ip1=ip1-1; ip1--; ip1-=2;
Subtraction(distance) ip1=&a[0]; ip2=&a[2]; printf("%d";ip2-ip1);
2pter point to ele.s of same array
Interger result