1 #include <iostream> 2 3 4 5 using namespace std; 6 7 //通过指针进行传递 8 void print_Values(int *x,size_t n) 9 { 10 for(size_t i=0;i!=n;i++) 11 { 12 cout<<x[i]<<endl; 13 } 14 } 15 //二维数组的传递 16 //一共有rowSize行 每一行有十个 17 void print_Values1(int (*x)[10],int rowSize) 18 { 19 for(size_t i=0;i!=rowSize;++i) 20 { 21 for(size_t j=0;j!=10;++j) 22 { 23 cout<<x[i][j]<<" "; 24 } 25 cout<<endl; 26 } 27 } 28 29 int main() 30 { 31 int arr[]={1,2,3,4,5,6,7,8,9,0}; 32 int arr1[][10]= 33 { 34 { 35 1,2,3,4,5,6,7,8,9,0 36 }, 37 { 38 12,23,34,45,56,67,78,89,90,100 39 } 40 }; 41 print_Values(arr,10); 42 cout<<"===================="<<endl; 43 print_Values1(arr1,2); 44 return 0; 45 //预处理进行调试 46 #ifdef NDEBUG 47 cout<<""<<endl; 48 #endif // NDEBUG 49 }