arrays of linked list help

Kevin R. Minor kminor at ms.uky.edu
Sat Mar 24 14:50:26 AEST 1990


     I have a question about arrays of linked lists.  I am working
on a program that must access data very quickly, and this method looks
like the best to me in terms of saving memory, and keeping speed quick.
Here's an example of my structure.

struct node {
  .
  .
  .
  struct node *next
};

Now, I define the following array

struct node *list [LISTSIZE];

Now, here's my questions:

     How do I access an element of this list?  Do I do list [i] -> stuff, or
must I use parentheses, and if so, where?

     How do I send one element of this list to a function?  I am trying, for
instance, to insert some data into my list.  Let's say I want to insert into
list [3]  My function declaration is

insert (struct node *list, int data)

I call the function

insert (list [i], 32);

I know that the function doesn't return anything, but I'm not interested in
that now.  I mainly need to know how to access individual elements in the list.

Thanks in advance.

Kevin (kminor at ms.uky.edu)
-- 
I want to be the disc jockey at WWV



More information about the Comp.lang.c mailing list