欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

笔记

程序员文章站 2022-07-12 21:09:39
...
#include <iostream>
using namespace std;

int main()
{
	int a = 10;
	int b = 20;
	int c = 30;
	int *p[3] = {&a,&b,&c};

	for(int **q = p; q != p + 3; q++)
	{
		cout << **q << endl;
	}
	return 0;
}


#include <iostream>
using namespace std;

int main()
{
	int ia[3][4] = {1,2,3,4,5,6,7,8,9,10,11,12};
	for(int (*p)[4] = ia; p != ia + 3; p++)
	{
		for(int *q = *p; q != *p + 4;q++)
		{
			cout << *q << endl;
		}
	}
	return 0;
}

#include <iostream>
using namespace std;

int main()
{
	int ia[3][4] = {1,2,3,4,5,6,7,8,9,10,11,12};
	typedef int int_array[4];
	for(int_array *p = ia; p != ia + 3; p++)
	{
		for(int *q = *p; q != *p + 4;q++)
		{
			cout << *q << endl;
		}
	}
	return 0;
}