|
哦,明白了,谢谢
那就是这样了?
#include<iostream>
using namespace std;
void next(int *&p,int *&b)
{
p++;
b++;
}
void main()
{
int a[]={1,2,3,4};
int b[]={5,6,7,8};
int *s1=a;
int *s2=b;
cout<<"before function"<<endl;
cout<<s1<<endl;//输出s1,s2的首地址
cout<<s2<<endl;
cout<<*s1<<endl;//输出第一个数值
cout<<*s2<<endl;
next(s1,s2);//调用next函数
cout<<"after function"<<endl;
cout<<s1<<endl;//输出调用后的s1和s2的值
cout<<s2<<endl;
cout<<*s1<<endl;//输出第二个数值
cout<<*s2<<endl;
} |
|