Header Node

This is a discussion on Header Node within the C Programming forums, part of the General Programming Boards category; Can someone tell me how to implement a header node data structure?...

  1. #1
    Registered User
    Join Date
    Apr 2002
    Posts
    23

    Header Node

    Can someone tell me how to implement a header node data structure?

  2. #2
    moi
    moi is offline
    Registered User moi's Avatar
    Join Date
    Jul 2002
    Posts
    946
    why do you need to impliment this? homework problem? then start by reading the relevant sections of the book. any other use? with linked lists and such, if you know why you need it, you usually know how to do it too.
    hello, internet!

  3. #3
    Registered User
    Join Date
    Apr 2002
    Posts
    23
    This is what I came up with, is there anything missing?

    typedef struct
    {
    int num;
    char name[20];
    int qty;
    } DATA;

    typedef struct
    {
    int count;
    struct nodeTag *pos;
    } HEADER;

    typedef struct nodeTag
    {
    DATA data;
    struct nodeTag *back;
    struct nodeTag *fore;
    } NODE;

  4. #4
    moi
    moi is offline
    Registered User moi's Avatar
    Join Date
    Jul 2002
    Posts
    946
    the HEADER needs to be defined after the NODE because when you define the HEADER it has no idea what a struct nodeTag; is
    hello, internet!

  5. #5
    Registered User
    Join Date
    Apr 2002
    Posts
    23
    Where do I put the link from the header node to the first node?

  6. #6
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Define 'header node'? What is its purpose in comparison to other nodes? Is it just an anchor point for your list? If so, don't bother making it an actual node, just use a global node pointer.

    struct Node *myList;

    Otherwise, you need to clarify the issue. What exactly are you trying to do?

    Quzah.
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. question about a working linked list
    By cold_dog in forum C++ Programming
    Replies: 23
    Last Post: 09-13-2006, 02:00 AM
  2. Anyone good with linked list.....I am not....
    By chadsxe in forum C++ Programming
    Replies: 11
    Last Post: 11-10-2005, 02:48 PM
  3. Help here with qsort!
    By xxxrugby in forum C Programming
    Replies: 11
    Last Post: 02-09-2005, 08:52 AM
  4. Translating Java to C. Mergesorting linked list.
    By Mikro in forum C Programming
    Replies: 10
    Last Post: 06-22-2004, 12:34 PM
  5. Dynamic list of Objects in External File
    By TechWins in forum C++ Programming
    Replies: 3
    Last Post: 12-18-2002, 02:05 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21