33,311
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
//#include <fstream>
using namespace std;
void copy_ptr(const double (*a)[4], double (*b)[4], int n)
{
for(int i=0;i<n;++i)
{
for(int j=0;j<4;++j)
*(*(b+i)+j)=*(*(a+i)+j);
}
}
int main()
{
double source[][4] = {{1.0,2.0,3.0,4.0},
{4.0,5.0,6.0,7.0},
{8.0,9.0,5.0,7.0}};
double target[3][4];
copy_ptr(source,target, 3);
for(int i=0;i<3;++i)
{
for(int j=0;j<4;++j)
cout<<target[i][j]<<" ";
cout<<endl;
}
cout<<endl;
system("pause");
return 0;
}