Linked_List_Example.c
/*
This function adds new node to the end of the list
In the while loop function iterates to the end of the 
list by checking NULL. Then new node created and 
added to the end of the list
*/
This function adds new node to the end of the list
In the while loop function iterates to the end of the
list by checking NULL. Then new node created and
added to the end of the list
This function adds new node to the end of the list In the while loop function iterates to the end of the list by checking NULL . Then new node created and added to the end of the list
void add_end(node_t * head, int val) 
{
	node_t * current = head;
	while (current->next != NULL) 
	{
		current = current->next;
	}
	current->next = malloc(sizeof(node_t));
	current->next->val = val;
	current->next->next = NULL;
}
void add_end ( node_t * head , int val ) { node_t * current = head ; while ( current -> next != NULL ) { current = current -> next ; } current -> next = malloc ( sizeof ( node_t ) ) ; current -> next -> val = val ; current -> next -> next = NULL ; }
This function adds new node to the end of the list
In the while loop function iterates to the end of the
list by checking NULL.
This function adds new node to the end of the list In the while loop function iterates to the end of the list by checking NULL .
/* now we can add a new variable */