I'm trying to store the value of an address in a non pointer int variable, when I try to convert it I get the compile error "invalid conversion from 'int*' to 'int'" this is the code I'm using:
#include <cstdlib> #include <iostream> #include <vector> using namespace std; vector<int> test; int main() { int *ip; int pointervalue = 50; int thatvalue = 1; ip = &pointervalue; thatvalue = ip; cout << ip << endl; test.push_back(thatvalue); cout << test[0] << endl; return 0; }
uintptr_t), any arithmetic you may want to do with the result is either easier with pointers, or even less portable.