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

Discussion in 'C Programming' started by Skyer, Jan 3, 2007.

  1. Skyer

    Skyer Guest

    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
    Skyer, Jan 3, 2007
    #1
    1. Advertising

  2. On Jan 3, 8:29 am, "Skyer" <> 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
    Pierre Lombard, Jan 3, 2007
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chris Fogelklou
    Replies:
    36
    Views:
    1,373
    Chris Fogelklou
    Apr 20, 2004
  2. Mark A. Odell

    Q: volatile struct elements or entire struct?

    Mark A. Odell, Sep 22, 2004, in forum: C Programming
    Replies:
    3
    Views:
    693
    Mark A. Odell
    Sep 23, 2004
  3. Daniel Rudy
    Replies:
    7
    Views:
    449
    Daniel Rudy
    Mar 31, 2006
  4. Adam Hartshorne
    Replies:
    2
    Views:
    373
    Nitin Motgi
    Jan 27, 2006
  5. Tuan  Bui
    Replies:
    14
    Views:
    473
    it_says_BALLS_on_your forehead
    Jul 29, 2005
Loading...

Share This Page