Created
July 16, 2017 18:20
-
-
Save amulyagaur/274c355115114ddb0ef3ea7a2f1bc15b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//function to insert a new node at the head of the list | |
node* InsertAtHead(node* head,int x) | |
{ | |
node* temp = new node(); //dynamically allocate a new node | |
temp->data =x; //sets the data part to the required value | |
temp->next=head; //sets the link part | |
head =temp; | |
return head; //returns the head pointer to calling function ie.main() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment