c++ 指针数组的简单运用
程序员文章站
2022-07-15 08:36:09
...
#include<iostream>
using namespace std;
int main (){
int line1[] = {1,2,3};
int line2[] = {4,5,6,7};
int line3[] = {7,8,9};
int* pline[3] = {line1,line2,line3};//定义指针类型数组并初始化
cout <<"输出矩阵"<<endl;
for(int i = 0;i < 3;i++){ //输出矩阵
for(int j = 0;j < 3;j++){
cout<<pline[i][j]<<' ';
}
cout << endl;
}
return 0;
}