// test_array.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "stdio.h"
//#include <iostream>
//using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
int **p_array;
p_array=new int*[4];
const int height=4;
const int width=4;
int a[height][width];
for(int i=0;i<height;i++)
{
for(int j=0;j<width;j++)
{
a[i][j]=i+j;
//printf("%d\n",a[i][j]);
}
}
int ar;
//p_array=&a[0][0];
p_array[0]=a[0];
p_array[1]=a[1];
p_array[2]=a[2];
p_array[3]=a[3];
for(int i=0;i<height;i++)
{
for(int j=0;j<width;j++)
{
printf("%d\n",p_array[i][j]);
printf("%d\n",a[i][j]);
cin>>ar;
//scanf("%d",ar);
}
}
return 0;
}
静态二维数组与指针数组
最新推荐文章于 2025-03-28 18:48:21 发布