Answers for "linkedlist add in the front"

C
0

Adding items to the beginning of a linked list

void push(node_t ** head, int val) {
    node_t * new_node;
    new_node = (node_t *) malloc(sizeof(node_t));

    new_node->val = val;
    new_node->next = *head;
    *head = new_node;
}
Posted by: Guest on June-02-2021

Code answers related to "C"

Browse Popular Code Answers by Language