(int*&) question

B

Bo Sun

hi:

please take a look at the following code:

void* vp;

int vp_test = 20;

vp = & vp_test;

((int*&)vp) ++;

how to interpret ((int*&)vp) ++?

thanks,

bo
 
D

Dave

Bo Sun said:
hi:

please take a look at the following code:

void* vp;

int vp_test = 20;

vp = & vp_test;

((int*&)vp) ++;

how to interpret ((int*&)vp) ++?

thanks,

bo

int *& is a reference to a pointer to int. After the cast, you've got
something that's referring to (i.e. is an alias for) a pointer to int. You
then increment that pointer by the size of one int (4 bytes on most
architectures). The result is then simply discarded since you do nothing
with it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,802
Messages
2,569,662
Members
45,431
Latest member
AidaVardon

Latest Threads

Top