When an identifier of an array type appears in an expression other than sizeof
, address-of
(&
), or initialization of a reference, it's converted to a pointer
to the first array element. Therefore, p
means &p[0]
.
For int *p[2]
the type of expression &p
is int* (*)[2]
pointer to array of 2 pointers to int
.
p+1
move to next array element (is equivalent &p[0] + 1
) with increment sizeof(int*)
&p+1
move to next array. Increment is sizeof(p)
or 2 * sizeof(int*)
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…