Skip to content

Instantly share code, notes, and snippets.

@EvanGertis
Created February 5, 2019 13: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 EvanGertis/60719816bc8300177021a2188083981e to your computer and use it in GitHub Desktop.
Save EvanGertis/60719816bc8300177021a2188083981e to your computer and use it in GitHub Desktop.
struct node
{
int data;
struct node *link;
};
// inserts a node after the header node.
void insertAtEnd(struct node *head, int data)
{
struct node *p;
struct node *temp;
temp = (struct node *)malloc(sizeof(struct node));
temp->info = data;
p = head;
while (p->link != NULL)
{
p = p->link;
}
temp->link = p->link;
p->link = temp;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment