- 论坛徽章:
- 0
|
*(p+5)与p[5]一模一样!
C89
3.3.2.1 Array subscripting
Constraints
One of the expressions shall have type “pointer to object type,” the other expression shall have integral type, and the result has type “ type.”
Semantics
A postfix expression followed by an expression in square brackets [] is a subscripted designation of a member of an array object. The definition of the subscript operator [] is that E1[E2] is identical to (*(E1+(E2))). Because of the conversion rules that apply to the binary + operator, if E1 is an array object (equivalently, a pointer to the initial member of an array object) and E2 is an integer, E1[E2] designates the E2 -th member of E1 (counting from zero). |
|