Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > linked list

Reply
Thread Tools

linked list

 
 
MJK
Guest
Posts: n/a
 
      01-31-2008
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
 
Reply With Quote
 
 
 
 
Walter Roberson
Guest
Posts: n/a
 
      01-31-2008
In article <(E-Mail Removed)>,
MJK <(E-Mail Removed)> 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'.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Airplane Program with Linked Lists. The linked list portion is veryconfusing to me. jawdoc C++ 9 03-10-2008 03:38 AM
Linked list within a linked list joshd C++ 12 10-02-2006 08:57 AM
Linked list, New try (was:Linked list, no out put,help) fool C Programming 14 07-03-2006 12:29 AM
Generating a char* from a linked list of linked lists Chris Ritchey C++ 7 07-10-2003 10:12 PM
Generating a char* from a linked list of linked lists Chris Ritchey C Programming 7 07-10-2003 10:12 PM



Advertisments