一,二维数组的架构与逻辑
1.a[3][4] = {a[0], a[1], a[2]} ={{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}};
二维m×n --> m个一维数组 --> 每个一维数组包含n个元素
不废话,直接看图
2,确定的公式
a[0] = a[0]+0 = &a[0][0] = *(a+0)+0 = *a
a = &a[0] = &(&a[0][0]) = &(*a) a;
二, 二维数组中按层级解释
1,二维数组中的一维数组
a[0] = a[0]+0 = &a[0][0] = *(a+0)+0 = *a
a[1] = a[1]+0 = &a[1][0] = *(a+1)+0 = *(a+1)
a[n] = a[n]+0 = &a[n][0] = *(a+n)+0 = *(a+n)
2,二维数组中一维数组的元素地址
a[0][2] --> a[0]+2 = &a[0][2] = *(a+0)+2 = *a+2
a[1][3] --> a[1]+3 = &a[1][3] = *(a+1)+3 = *(a+1)+3
a[i][j] --> a[i]+j = &a[i][j] = *(a+i)+j = *(a+i)+j
3,在指针数组和数组指针中更需小心
---------------------