C允两者不一致,而C++则不允许.
//......
void *f;
int i=1,*p;
f=&i;
p=(int*)f;
f=p;
cout<<"p is "<<p<<*p;
cout<<"f is "<<f<<*f; // void 的值不能显示,故编译报错
//......
void *f;
int i=1,*p;
f=&i;
p=(int*)f;
f=p;
cout<<"p is "<<p<<*p;
cout<<"f is "<<f<<*f; // void 的值不能显示,故编译报错
转载于:https://www.cnblogs.com/yjm0105/archive/2005/05/08/151189.html