Thread: Structure Issue

  1. #1
    Registered User
    Join Date
    Jun 2003
    Posts
    147

    Structure Issue

    If I have a collection of data which will be assigned their values via input from the user, and I would like to loop this collection of data so that I can enter another set of values for this collection of data.

    This collection of data is actually located in a structure.

    In order to store these data, must I have an array variable of this structure? If I use a single linked list, must I still use an array?
    Only by the cross are you saved...

  2. #2
    eh ya hoser, got a beer? stumon's Avatar
    Join Date
    Feb 2003
    Posts
    323
    If you use a linked list, you will not need an array becuase each structure will have a pointer pointing to the next list so you will be able to get each set of information.
    The keyboard is the standard device used to cause computer errors!

  3. #3
    Been here, done that.
    Join Date
    May 2003
    Posts
    1,164
    Stumon is correct if you create the structure dynamically for each input -- IOW every time data is entered, you need to malloc() a copy of the structure. The link would be a ponter to the address of the next structiore

    Or, create an array of the structure and the link would be a subscript to the next entry in the array. This form requires you to define a maximum number of entries in the collection.
    Definition: Politics -- Latin, from
    poly meaning many and
    tics meaning blood sucking parasites
    -- Tom Smothers

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Strange structure array issue...
    By IndioDoido in forum C Programming
    Replies: 9
    Last Post: 03-23-2008, 06:29 AM
  2. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  3. An class structure issue
    By conright in forum C++ Programming
    Replies: 5
    Last Post: 12-31-2002, 04:56 PM
  4. Serial Communications in C
    By ExDigit in forum Windows Programming
    Replies: 7
    Last Post: 01-09-2002, 10:52 AM
  5. C structure within structure problem, need help
    By Unregistered in forum C Programming
    Replies: 5
    Last Post: 11-30-2001, 05:48 PM