











Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!












Pointers
flat memory model in 32-bit environment
*int i = 20; int ptr = &i;
Address of i (&i)
20
variable
Constant or literal ptr i pointer (^) points to
pointer to int
207 208 209 210 211 212 213
( * ) Indirection / De_referencing
( & ) Address / Reference
*double d, ptr_d;
*char c, ptr_c;
ptr_d = &d;
ptr_c = &c;
ptr_d = ptr_d + 1; // Skips 8 bytes in memory
ptr_c = ptr_c +1; // Skips 1 byte in memory
int m, *ptr; ptr=&m;
270
274
270
270
271
271 272 273 274
272 273 274
ptr=pt + 1;
ptr
ptr
In Win32 programming int and long are of
same size (4 bytes)
=4,29,49,67, =0xffffffff
Which bytes are modified? *long double i, ptr; ptr = &i;
***((char ) ((long ) ptr+1)+2) = 91;
***((short int )((long )ptr+2)-1)=91;