[prev] 73 [next]

Pointers and Structures (cont)

General principle …

If we have:

SomeStructType  s,   *sp = &s;

then the following are all equivalent:

s.SomeElem    sp->SomeElem    (*sp).SomeElem

[Diagram:Pic/structptr2.png]