我正在尝试将地址的值存储在非指针 int 变量中,当我尝试对其进行转换时,我得到编译错误“从'int *'到'int'的无效转换”这是我正在使用的代码:
#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;
}