#include<iostream>
using namespace std;
//测试
//传引用:改变值,相当于别名
//传指针:改变传递进去的指针对应的地址的值
//返回指针:可以修改对应指针对应地址处的值
int* test(int &c, int *d)
{
int b[4] = {1,2,3,4};
c = 5;
d[2] = 99;
return b;
}
int main()
{
int *a = NULL;
int c;
int d[4] = {2,3,4,5};
a = test(c,d);
cout<<a[0]<<c<<d[2]<<endl;//1,5,99
return 0;
}
转载于:https://www.cnblogs.com/iplus/archive/2013/04/11/4467193.html