1. 程式人生 > >C語言:陣列指標總結

C語言:陣列指標總結

#include<stdio.h>

//int (*brr)[3]  陣列指標
//int *brr[3]    指標陣列
int main()
{
	int brr[2][3] = {1,2,3,4,5,6};
	printf("brr == %d\n",brr);
	printf("brr+1 ==%d\n",brr+1);
	printf("*brr+1 == %d\n",*brr+1);
	printf("*(brr+1) == %d\n",*(brr+1));
	printf("*(brr+1)+2===>%d\n",*(brr+1)+2);
	printf("&brr[1][2]==>%d\n",&brr[1][2]);
	printf("*(*(brr+1)+2)====%d\n",*(*(brr+1)+2));
	printf("*(brr[1]+2)===>%d\n",*(brr[1]+2));

	getchar();
	return 0;
}

答案:brr == 11533740 brr+1 11533752 *brr+1 == 11533744 *(brr+1) == 11533752 *(brr+1)+2=>11533760 &brr[1][2]==>11533760 ((brr+1)+2)==6 *(brr[1]+2)=>6