Answers for "how to create a list in c"

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
-1

creating lists in C

typedef struct node{
    int x;
    struct node *next;
}node;

node *create_node(int x){
    node *new_node = malloc(sizeof(node));
    new_node->x = x;
    new_node->next = NULL;
    return new_node;
}
Posted by: Guest on May-24-2021

Code answers related to "how to create a list in c"

Code answers related to "C"

Browse Popular Code Answers by Language