Answers for "how to initialize a linked list"

C
18

how to make a linked list in c

typedef struct node{
    int value; //this is the value the node stores
    struct node *next; //this is the node the current node points to. this is how the nodes link
}node;

node *createNode(int val){
    node *newNode = malloc(sizeof(node));
    newNode->value = val;
    newNode->next = NULL;
    return newNode;
}
Posted by: Guest on June-21-2020
0

initialize linked list in java

LinkedList<type> linkedList1 = new LinkedList<>();
// or
LinkedList<type> linkedList2 = new LinkedList<type>();
Posted by: Guest on July-09-2021

Code answers related to "how to initialize a linked list"

Code answers related to "C"

Browse Popular Code Answers by Language