Given a pointer to int
, how can I obtain the actual int
?
I don\'t know if this is possible or not, but can someone please advise me?
int Array[10];
int *ptr6 = &Array[6];
int *ptr0 = &Array[0];
uintptr_t int_adress_6 = reinterpret_cast (ptr6);
uintptr_t int_adress_0 = reinterpret_cast (ptr0);
cout << "difference of casted addrs = " << int_adress_6 - int_adress_0 << endl; //24 bits
cout << "difference in integer = " << ptr6 - ptr0 << endl; //6