where is linked list created in c code example
Example 1: how to make a linked list in c
typedef struct node{
int value;
struct node *next;
}node;
node *createNode(int val){
node *newNode = malloc(sizeof(node));
newNode->value = val;
newNode->next = NULL;
return newNode;
}
Example 2: c linked list
typedef struct Node
{
void* data;
struct Node* next;
} Node;
Node *llNewList(void* data, Node* next)
{
Node* result =
(Node*)malloc(sizeof(Node));
result->data = data;
result->next = next;
return result;
}