Thread: Dynamic Linked Lists Confusion

  1. #1
    Registered User
    Join Date
    Oct 2013
    Posts
    75

    Dynamic Linked Lists Confusion

    Hello, thank you in advance for any answers. I am a bit confused on the directions for a homework assignment and was hoping someone could clarify a bit for me. In our homework assignment it states to, "write a set of dynamic linked lists" and so on. Now, the problem I'm confusing myself is at the storage inside of each node. To my understanding, each node contains the prev and next nodes, but also a pointer to the data, in this case being a string. He has asked us to manage these strings as rows of chars such as

    char[0] = c // first node being addressed here
    char[1] = a
    char[2] = t
    char[3] = \0
    char[4] = d // second node starting here
    char[5] = o
    char[6] = g
    char[7] = \0

    I have written my code where each node is holding a string, not separated as shown above... my question is to how you can build your doubly linked list where each node is being address a set of chars.

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    That means that your data field, instead of being a char array (or maybe a char * that you malloc memory for), should just be a char pointer to this single buffer.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help in dynamic and Linked Lists
    By joeymaharaj in forum C Programming
    Replies: 22
    Last Post: 02-27-2013, 03:04 AM
  2. Confusion about typedef and pointers in linked lists
    By mrdiegus in forum C Programming
    Replies: 6
    Last Post: 11-19-2012, 11:19 AM
  3. Double Linked Dynamic Lists Vs Unrolled Linked Lists
    By lantzvillian in forum C Programming
    Replies: 6
    Last Post: 02-14-2012, 01:07 PM
  4. Dynamic number of linked lists
    By foniks munkee in forum C Programming
    Replies: 2
    Last Post: 02-24-2002, 09:30 PM
  5. dynamic memory + linked lists
    By Unregistered in forum C Programming
    Replies: 1
    Last Post: 02-10-2002, 04:50 PM