动态创建数组举例:
int **t=new int *[3];//行
for(int i=0;i<3;i++)
{
t[i]=new int[5];//列
}
动态删除数组举例:
for(int i=0;i<3;i++)
{
delete[5]t[i];
t[i]=NULL;
}
t=NULL;
程序举例:
#include
using namespace std;
void main()
{
int **t;
t=new int *[3];
for(int i=0;i<3;i++)
t[i] = new int[5];
for(int i=0;i<3;i++)
for(int j=0;j<5;j++)
t[i][j]=i+j;
for(int i=0;i<3;i++)
{for(int j=0;j<5;j++)
cout<
for(int i=0;i<3;i++)
{
delete [5]t[i];
t[i]=NULL;
}
delete [3]t;
t=NULL;
}