指针的赋值运算

来源:互联网 发布:海关出口数据怎么查询 编辑:程序博客网 时间:2024/05/21 11:20
/*指针的赋值运算:将p1的值和地址赋给p*/#include <iostream>//输入输出流using namespace std;int main (){int *p=new int;cout<<"p:"<<p<<endl;int *p1=new int;*p1=3;cout<<"p1:"<<p1<<endl;p=p1;cout<<"赋值后p:"<<endl;cout<<p<<endl;cout<<"p的值:"<<*p<<endl;}

0 0
原创粉丝点击