Skip to content

Instantly share code, notes, and snippets.

@atoye1
Created December 13, 2021 15:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atoye1/de6d6fac36db5aab9d92d75bcc09a93b to your computer and use it in GitHub Desktop.
Save atoye1/de6d6fac36db5aab9d92d75bcc09a93b to your computer and use it in GitHub Desktop.
void addNode(linkedList_h*, int x){
listNode* NewNode;
listNode* LastNode;
NewNode = (linkedList_h*)malloc(sizeof(linkedList_h));
NewNode->data = x;
NewNode->link = NULL;
if (H->head == NULL){
H->head = NewNode;
NewNode->link = NULL;
return;
}
LastNode = H->head;
while(LastNode->link != NULL){
LastNode = LastNode->link;
}
lastNode->link = NewNode;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment