【杂】指针,*,&

时间:2023-06-24 21:30:02

一个小程序解释指针变量的作用:

#include<iostream>
#include"cww.h" void cloud(int *); using namespace std; int main(){
int n = ;
int *p = &n;
cloud(p);
cout<<"&n = "<<(&n)<<", n = "<<n<<endl;
system("PAUSE");
return ;
} void cloud(int *p)
{
*p = ;
cout<<" p = "<<p<<", *p = "<<(*p)<<endl;
}

输出:

  p = 003FFEB0,  *p =
&n = 003FFEB0, n =