You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
364 B

2 years ago
//6.2.4.2数组参数.cpp
#include <iostream>
using namespace std;
void showarr(int *&a);
void showptr(int *&a);
int main(){
int arr[]={1,4,7};
showarr(&arr[0]);
int a=12,*ptr=&a;
showptr(ptr);
cout << a << endl;
return 0;
}
void showarr(int *&a){
cout << *a << endl;
a++;
cout << *a << endl;
}
void showptr(int *&a){
cout << *a << endl;
*a=11;
}