Question: PP - 1 1 . 0 4 : Family - tree In order to represent the interconnected - ness of data, it is often important
PP: Familytree
In order to represent the interconnectedness of data, it is often important to have pointers
within a struct, either pointing to data of a different type or potentially pointing to the same
struct type. In the latter case, the syntax can be a bit awkward, as we have to create the
pointer before we have fully defined the struct itself!
Consider the following struct definition, which could be a useful way of representing a family
relationship:
Here we have defined a struct named person, that includes, as part of its definition,
pointers to other person variables representing a mother and father, respectively. With
this syntax, we have to be careful whether we are accessing a variable of the struct type or a
pointer to a variable of the struct type, as the following example illustrates:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
