program for insert at end of linked list code example
Example: how to add to the end of a linked list
typedef struct node{
int value; //this is the value the node stores
struct node *next; //this is the node the current node points to. this is how the nodes link
}node;
node *append(node *head, int val){
node *tmp = head;
node *createdNode = createNode(val);
while(tmp->next != NULL){
tmp = tmp->next;
}
tmp->next = createdNode;
return head;
}