Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started