December 17, 2017 15:58:41
Title: Defining a two-dimensional array of int a[3][4]={{1,3,5,7},{9,11,13,15},{17,19,21,23}}
1. Meaning: Array has 3 rows 4 columns
a[0]=== 1 3 5 7
a[1]=== 9 11 13 15
a[2]=== 17 19 21 23
A two-dimensional array a[3][4] is made up of 3 one-dimensional arrays.
That is, a represents the first address of the a[0] line. A+1 represents A[1] 's first address
If the first address of the two-dimensional array is 2000, then a+1 represents 2000+4*4=2016 (because 0 rows have 4 shaping data)
-->A+1=A[1] (A+1 is the first address of a[1]; A[0]->&a[0][0];a[1]->&a[1][0];a[2]=&a[2][0]
2. Consider the address of an array of 0 rows 1 column elements.
A[0]+1 (1 represents the number of bytes of an element, or 4 bytes) if the a[0] address is 2000,a[0]+1=2004->&a[0][1]
namely: a[0]+0 a[0]+1 a[0]+2 a[0]+3
&a[0][0] &a[0][1] &a[0][2] &a[0][3]
3. Summary of Details
Previously known: a[0]=* (a+0), a[1]=* (a+1), a[i] = * (a+i)
So: a[0]+1=* (a+0) +1=a[0][1], similarly: * (* (a+0) +1) =* (* (a+1)) =a[0][1]
namely: * (A[I]+J) =* (* (a+i) +j) =a[i][j].
It is important to remember that * (A+i) and a[i] are equivalent
4. Analysis of the nature of A[i]
A[i] from the formal surface is the element in the a array ordinal i.
If A is a one-dimensional array name, then A[i] represents the storage unit of an element of the array ordinal of I.
If A is a two-dimensional array, then a[i] is a one-dimensional array name, which is an address.
Eg:a,a+i,a[i], * (a+i), * (A+i) +j, a[i]+j are addresses.
And: * (A[I]+J), * (* (a+i) +j) is the value of the two-dimensional array element A[i][j]
5. Presentation Form
A two-dimensional array name, pointing to a one-dimensional array a[0], which is the first address of 0 rows 2000
A[0], * (a+0), *a 0 row 0 Column element address 2000
A+1, &a[1] 1 line element address 2016
A[1], * (a+1) 1 row 0 column element A[1][0] address 2016
A[1]+2, * (a+1) +2, &a[1][2] 1 row 2 column element a[1][2] address 2024
* (a[1]+2), * (* (a+1) +2), a[1][2] 1 rows 2 column element A[1][2] Value element value: 13
Note: * (a+1) is not the content (value) of the a+1 unit, because a+1 is not a storage unit
* (a+1) =a[1], and a[1] is a one-dimensional array name, so it is an address.
Pointers refer to multidimensional arrays