|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
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[i].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 |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
In article <3a727575-d6c7-47a9-a1c6-e84236b9b466@j78g2000hsd.googlegroups.com>,
MJK <jafarikia@gmail.com> wrote: >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[i].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 -- 'Roberson' is my family name; my given name is 'Walter'. |
|
![]() |
| Outils de la discussion | |
|
|