Detailed Explanation of "C Language Two-Dimensional Array Pointer" for Computer Science Upgrading Review (First Draft)

C language two-dimensional array pointer (pointer to two-dimensional array) detailed explanation

A two-dimensional array is " conceptually " two- dimensional, with rows and columns, but "in memory " all array elements are arranged consecutively , with no "gaps"  between them .

Take the following two-dimensional array a as an example

int a[3][4] = { {0,1,2,3},{4,5,6,7},{8,9,10,11}};

Conceptually , the distribution of a is like a matrix :

0   1   2   3

4   5   6   7

8   9   10  11

But in memory , the distribution of a is one-dimensional linear , and the entire array occupies a continuous memory:

0   1   2   3   4   5   6

Guess you like

Origin blog.csdn.net/weixin_51563198/article/details/122785535