Pointer Chapter
4. Properties of Array A
int A[3][4] = {{1,3,5,7},{9,11,13,15},{17,19,21,23}}
int data in the Keil compilation environment, accounting for 2 bytes of memory
Representation |
Meaning |
Address |
A |
Two-dimensional array name, pointing to an array a[0], which is the 0 header address |
Set 2000 |
A[0], * (a+0), *a |
0 row 0 Column element address |
2000 |
A+1,&A[1] |
1 row 0 Column element address |
2008 |
A[1], * (a+1) |
Address of 1 Rows 0 column element a[1][0] |
2008 |
A[1]+2, * (a+1) + 2, &[1][2] |
1 row 2 column (i.e. a[1][2]) element address |
2012 |
* (a[1]+2), * (* (a+1) +2), a[1][2] |
1 rows 2 columns (i.e. a[1][2]) element values |
Element 13 |
(1) Why does * (a+1) indicate the first address of a line?
Answer: * (a+x) ==a[x]; The two are equivalent.
(2) How does the C language cause * (A+X) and a[x] to be completely equivalent?
A: In an array, *a is a[0],a+1 pointing a[1],a+2 to a[2],a+3 pointing to a[3], which means
* (a+1), * (a+2), * (A+3) respectively a[1], a[2], a[3]. In the actual code generation mechanical code relationship, two effects are completely equivalent.
Next Update Time 2014.09.12
New understandings and insights can be exchanged with each other and learn together
Crazy C language Notes (pointers)