Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > array[x][y] with dynamic elements struct as list

Reply
Thread Tools

array[x][y] with dynamic elements struct as list

 
 
Skyer
Guest
Posts: n/a
 
      01-03-2007
How to write?

I have write program in C language. This program contain 1 array[20][20]
with struct. Every element of table must be dynamic list LIFO (stack).
Adding and removing struct variable from list array[x][y].
My question: How to declare this table?
How to begining, any ideas?

struct list {
int *type;
struct list *next_elem;
}element;

Example:
I add new element to array[20][1]
next i adding next elemtent do array[20][[1]
A remove first from array[20][1] - LIFO


 
Reply With Quote
 
 
 
 
Pierre Lombard
Guest
Posts: n/a
 
      01-03-2007
On Jan 3, 8:29 am, "Skyer" <q...@o2.pl> wrote:
> How to write?
>
> I have write program in C language. This program contain 1 array[20][20]
> with struct. Every element of table must be dynamic list LIFO (stack).
> Adding and removing struct variable from list array[x][y].
> My question: How to declare this table?
> How to begining, any ideas?
>
> struct list {
> int *type;
> struct list *next_elem;
>
> }element;Example:
> I add new element to array[20][1]
> next i adding next elemtent do array[20][[1]
> A remove first from array[20][1] - LIFO


If I understand your question, I'd say:
struct list * array[20][20];

Note that if you use a array whose size is 20, it goes from 0 to 19 in
C.
Hence, do not use array[20][1] for instance.

--
Pierre

 
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
Can *common* struct-members of 2 different struct-types, that are thesame for the first common members, be accessed via pointer cast to either struct-type? John Reye C Programming 28 05-08-2012 12:24 AM
Appending a list's elements to another list using a list comprehension Debajit Adhikary Python 17 10-18-2007 06:45 PM
Removing elements from a list that are elements in another list Adam Hartshorne C++ 2 01-27-2006 07:47 AM
Q: volatile struct elements or entire struct? Mark A. Odell C Programming 3 09-23-2004 12:50 PM
struct my_struct *p = (struct my_struct *)malloc(sizeof(struct my_struct)); Chris Fogelklou C Programming 36 04-20-2004 08:27 AM



Advertisments