num的地址什么时候才变,我中间有隔还几分钟分钟运行一次地址还是不变,ptr_int很听话一直在变。
还有报错的那句话,是C++没用这种用法吗,是没法输入修改指针类型内存值,还是没法输入修改new类型内存值?
注释语句的报错提示
error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}' and '<unresolved overloaded function type>')|
int num = 213;
int *ptr_int = new int;
//cin >> *ptr_int >> endl ;这句话加上就报错
*ptr_int = 10;
cout << "num数值和地址:"<< num << '\t'<< &num << '\t'<< endl
<< "ptr_int数值和地址:"<< *ptr_int<< '\t'<< ptr_int<< '\t'<< endl ;
delete ptr_int;
return 0;
onemoo