DEV Community

Hidden member
Hidden member

Posted on

I have a issue while creating doubly LL using function

include

include

struct node
{
struct node *prev;
int data;
struct node *next;
};

struct node addDataFunc(struct node *head, int data)
{
struct node *temp = malloc(sizeof(struct node));

temp->prev = NULL;
temp->data = data;
temp->next = NULL;
head = temp;
return head;
Enter fullscreen mode Exit fullscreen mode

}

int main()
{
struct node *head = NULL;
head = addDataFunc(head, 36);
printf("%d", head->data);
return 0;
}

// I have to create a function to add data in struct node datatype doubly link list, but showing above. I want proper code. please help

Top comments (0)