Home > Back-end >  Great god & a two-dimensional array [1] can be & * (1 a) or * (& 1 a)
Great god & a two-dimensional array [1] can be & * (1 a) or * (& 1 a)

Time:09-18

A two-dimensional array & amp; A [1] can be seen as the first element to address a shift to the right one a + 1, then the indirect reference to get the second element is the first address * (a + 1), and then take it first address in the address & amp; (* (a + 1))?
The following one,4,8 is why the results of this program?

Int main ()

{

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

Int * p=a;

Int (* p2) [2]=& amp; A, [1].

+ + p;

+ + p2.

Printf (" % d \ n ", * p).

Printf (" % d \ n ", * * (p2);

Printf (" % d \ n ", p2 [1] [2]).

Return 0;

}

CodePudding user response:

[I] is equivalent to a * (a + I)
A + I equate to & amp; A [I]
  • Related