Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Obviously, there is a relationship between array subscripts [] and pointers. The expression dis[i] is equivalent to *(dis+i) for all integral values of i. In other words, if dis is an array object (equivalently, a pointer to the initial element of an array object) and i is an integer, dis[i] designates the ith element of dis. In fact, because *(dis+i) can be expressed as *(i+dis), the expression dis[i] can be represented as i[dis], although doing so is not encouraged. Since Because array indices are zero-based, the first element is designated as dis[0], or equivalently as *(dis+0) or simply *dis.

...