Answers on accessing structs and unions via pointers

  1. For each of the following give the equivalent using the -> notation.
    1. (*sp1).fred
      sp1->fred

    2. (*sp1).(*fred).age
      sp1->fred->age

  2. For each of the following give the equivalent using the dot access operator.
    1. amy->next
      (*amy).next

    2. amy->first.name
      (*amy).first.name

Back to the questions.


Back to notes on accessing structs through pointers.