Last active
August 29, 2015 14:26
-
-
Save honux77/8a25410e5d1043021b42 to your computer and use it in GitHub Desktop.
NodeInsert.cpp
This file contains hidden or 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
| Node* Insert(Node *head,int data) | |
| { | |
| Node *node = head; | |
| Node *newNode = new Node(); | |
| newNode->data = data; | |
| newNode->next = NULL; | |
| if (node == NULL) | |
| return newNode; | |
| while (node->next) | |
| node = node->next; | |
| node->next = newNode; | |
| return head; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment