Circular linke lists

hello everyone, i have been suffering from linked lists

for a long time, i have the code for linear linked lists

and it works perfectly to insert a letter and to delete

a letter. Now i want to modify it to make it circular

that is the last node should not be NULL it should point

to the first one.. Any help would be great

thanx in advance.


Comments

  • : hello everyone, i have been suffering from linked lists

    : for a long time, i have the code for linear linked lists

    : and it works perfectly to insert a letter and to delete

    : a letter. Now i want to modify it to make it circular

    : that is the last node should not be NULL it should point

    : to the first one.. Any help would be great

    : thanx in advance.


    This is mostly unwritten since I don't want to spend a whole night making linked list code:


    typedef struct node

    {

    char *data;

    node *next;

    } node;


    int main ()


    node *Start, *Temp;


    //Get pointer to first node (nodes are linked list pieces).


    //Fill up nodes here


    //Point the last node's "next" to first node's address located at the variable Start.


    return 0;

    }


    That's it. Just remember what the first node's address is/was and point the end node's next to the first node.


    -Xotor-




Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories