Skip to content

Instantly share code, notes, and snippets.

@omonimus1
Created August 15, 2020 14:22
Show Gist options
  • Save omonimus1/f9a109d7c638670d51d05ba68a6615da to your computer and use it in GitHub Desktop.
Save omonimus1/f9a109d7c638670d51d05ba68a6615da to your computer and use it in GitHub Desktop.
Having the values of a new node, set this new node as head of the linked.
Node* push_in_head(Node *head, int new_value)
{
Node *new_node = new Node(new_value);
if(head == NULL)
return new_node;
else
{
new_node->next= head;
return new_node;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment