0

Hello I try to make one linked list to double linked list but i have some probems with this

.Can somebody help me?

This is yhe the linked list:

```
typedef struct ns
{
int data;
struct ns *next;
} node;
node *list_add(node **p, int i)
{
node *n = (node *)malloc(sizeof(node));
if (n == NULL)
return NULL;
n->next = *p;
*p = n;
n->data = i;
return *p;
}
void list_remove(node **p) /* remove head */
{
if (*p != NULL)
{
node *n = *p;
*p = (*p)->next;
free(n);
}
}
node **list_search(node **n, int i)
{
while (*n != NULL)
{
if ((*n)->data == i)
return n;
n = &(*n)->next;
}
return NULL;
}
```

Ok the structure have to be

```
typedef struct ns
{
struct ns *next;
int data;
struct ns *next;
} node;
```

With add fuction I think something like that,but i'm not sure

```
node *list_add(node **p, int i)
{
node *n = (node *)malloc(sizeof(node));
if (n == NULL)
return NULL;
n->next = *p;
*p = n;
n->prev = NULL;
n->data = i;
return *p;
}
```

for the remove and search function i have no idea

Thanks in advance