Write the syntax in C to create a node in the singly linked list.

Category: Data StructureWrite the syntax in C to create a node in the singly linked list.
1 Answers
Editor">Editor Staff answered 2 years ago

struct node
{
int data;
struct node *next;
};
struct node *head, *ptr;
ptr = (struct node *)malloc(sizeof(struct node));