C++引用输出
#include "Program.h"
#include "ArrayTest.h"
#include "Common.h"
void ChangeDatasByRef(int &m,int &n);
int main()
{
int datas[10]={10,1,2,3,4,5,6,7,8,9};
ChangeArray(datas);
cout<<"After Changed the Array"<<endl;
//int len=GetMyArrayLen(datas);
int len=GetArrayLen(datas);
//int len=10;
for (int i=0;i<len;i++)
{
cout<<datas[i]<<" ";
}
cout<<endl;
int num=200;
int nun=200;
ChangeDatasByRef(num,nun);
cout<<num<<" "<<nun<<endl;//输出100,100
int result;
cin>>result;
return 0;
}
void ChangeDatasByRef(int &m,int &n)//通过引用改变原来的值
{
m=100;
n=100;
}