#include <iostream>
using namespace std;
int main()
{
int a=5;
const int b=6;
const int *p=NULL;
int const *p1=NULL;
p1=&b;
p=&a;
cout<<"p1 "<<p1<<" *p1 "<<*p1<<" "<<endl;
cout<<" p "<<p<<" *p "<<*p<<" "<<endl;
cout<<"&a "<<&a <<" &b "<<&b<<endl;
a=66;
cout<<" p "<<p<<" *p "<<*p<<" "<<endl;
int j=667;
p=&j;
p1=&j;
cout<<"p1 "<<p1<<" *p1 "<<*p1<<" "<<endl;
cout<<" p "<<p<<" *p "<<*p<<" "<<endl;
int *p2=&j;
cout<<*p2<<endl;
*p2=5;
cout<<*p2<<endl;
return 0;
}晕死了
以前看那多的资料,
结果我自己试验一下,指针常量和常量指针不是都可以改变他们已经指向了的地址的吗?但他们好像不能够自己去更改数字?
例如*p=5;这样就出错》?
那好像说的还有一种类型是指针可以改变数值,但不能更改地址的
是哪一种的?