C++对指针的指针和指针数组的编程

#include<iostream>
using namespace std;
void display(int **ptr)
{
	for(int i = 0;i < 3;i++)
	{
		for(int j = 0;j < 5;j++)
		{
			cout<<ptr[i][j]<<"  ";
		
		}
		cout<<endl;
	
	}
}
int main()
{
	int row = 3;
	int column = 5;
	int **p = new int *[row];
	for(int i = 0;i<row;i++)
	{
		p[i] = new int[column];
		for(int j = 0;j<column;j++)
		{
			p[i][j] = 0;
		}
	}

	display(p);

}
发布了114 篇原创文章 · 获赞 28 · 访问量 4万+

猜你喜欢

转载自blog.csdn.net/ChaoFeiLi/article/details/103674308
今日推荐