linked list

M

MJK

Hello all,

When I am using array in structure to read a pedigree, I can simply
call an index to see how old is the dad of individual 'i':

Individual[ individual.dad_id ].Age

The above example is in a coded pedigree (pedigree starts from
individual '0').

I am wondering how I can do the same as above when I am using the
linked list.

Thanks,
MJ
 
W

Walter Roberson

MJK said:
When I am using array in structure to read a pedigree, I can simply
call an index to see how old is the dad of individual 'i':
Individual[ individual.dad_id ].Age

The above example is in a coded pedigree (pedigree starts from
individual '0').
I am wondering how I can do the same as above when I am using the
linked list.

If you transform individual into a linked list instead of an
array, then NO, C does not provide any operations to traverse
from the head of a list to the i'th node. On the other hand, you
can easily write your own routine that returns a pointer to
the i'th node, and then use:

find_ith( individual, find_ith( individual, i)->dad_id )->Age
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top