学习笔记:测试指向二维数组的指针

参考书目:C/C++规范设计简明教程,P172

//P172 测试一维数组指针
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <stdio.h>
#include <math.h>
using namespace std;
int main()
{
	cout << "Hello World!\n";
	int magic[3][3] = { {1, 2,3},{4, 5,6}, {7, 8,9} };
	int(*pMagic)[3];

	pMagic = magic;
	cout << pMagic << endl;		//显示头地址
	cout << *pMagic << endl;	
	cout << *(*pMagic+3) << endl;	//显示第4个元素
	getchar();
}
发布了34 篇原创文章 · 获赞 1 · 访问量 758

猜你喜欢

转载自blog.csdn.net/qq_41708281/article/details/104130997