编写代码分别更改指针的值以及指针所指对象的值。 样例输出: 0x28ff44 5 0x28ff40 10 0x28ff40 20 0x28ff40 30
#include<iostream>
using namespace std;
int main()
{
int i = 5,j = 10;
int *p = &i;
cout<< p << " " << *p <<endl;
p = &j;
cout<< p << " " << *p <<endl;
*p = 20;
cout<< p << " " << *p <<endl;
j = 30;
cout<< p << " " << *p <<endl;
return 0;
}