Files
notes_estom/C++/面试/23.cpp
2021-04-21 15:52:01 +08:00

28 lines
433 B
C++

#include <iostream>
#include <vector>
using namespace std;
// 测试字符串和字符数组的参数传递
void test1(int *s){
cout<<*(s)<<endl;
return;
}
void test2(int s[]){
cout<<*s<<endl;
return;
}
void test3(int s[5]){
cout<<*s<<endl;
return;
}
int main()
{
int s1[]={1,2,3,4,5,6,7,8};
int s2[3]={4,5,6};
int* s3 = new int(999);
test1(s3);
test2(s3);
test3(s3);
return 0;
}