自考新教材-p59_4(2)

源程序:

#include <iostream>
using namespace std;
int main()
{
int oneInt = 1;
int &ref = oneInt;
ref = 2;
cout << "oneInt=" << oneInt << "," << "ref=" << ref << endl;
int *p = &ref;
*p = 3;
cout << "ref=" << "," << "p的地址:" << p << ",p的值:" << *p << endl;
system("pause");
return 1;
}

运行结果:

 

posted @ 2020-02-06 14:15  bobo哥  阅读(129)  评论(0编辑  收藏  举报