I am trying to make a doubly linked list that loops around, so the last link is connected to the first one.
However, I cannot figure out what I am doing wrong with the backlink, as I can print my list forwards but not backwards.
Any tip/help would be much appreciated.

This is my structure definition:

```
struct  NODE {
    union {
        int  nodeCounter;
        void  *dataitem;
    } item;

    struct NODE *link;
    struct NODE *backlink;
};

//function to create a list
struct NODE *InitList() {
    struct NODE *temp = (struct NODE*)malloc(sizeof NODE);

    temp->item.nodeCounter = 0;
    temp->link = NULL;
    temp->backlink = NULL;

    return temp;
}

```

This is my insert function:

```
void  Add2List(struct NODE *start, struct NODE *NewNode) {
    struct NODE *current = start;

    while (current->link != NULL && current->link != start) {
        current = current->link;
    }
    current->link = NewNode;

    NewNode->link = start;
    NewNode->backlink = current;
    start->backlink = NewNode;

    start->item.nodeCounter++;
}

```

and this is my print backwards function:

```
void PrintBackwards(struct NODE *start) {
    struct NODE * current = start;

    while(current->backlink != start) {
        DisplayNode((struct inventory*)current->item.dataitem);
        current = current->backlink; //go one node back
    }
}

```