Linked_List_Example.c
/*
This function pops out the first node of the list and 
return its value. Firstly containers of the first node
taken to the another pointer then the memory freed. Lastly,
head pointer updated.
*/
This function pops out the first node of the list and
return its value. Firstly containers of the first node
taken to the another pointer then the memory freed. Lastly,
head pointer updated.
This function pops out the first node of the list and return its value . Firstly containers of the first node taken to the another pointer then the memory freed . Lastly head pointer updated .
int pop(node_t ** head_ref) 
{
	int retval = -1;
	node_t * next_node = NULL;
	if (*head == NULL) {
		return -1;
	}
	next_node = (*head_ref)->next;
	retval = (*head_ref)->val;
	free(*head_ref);
	*head_ref = next_node;
	return retval;
}
int pop ( node_t * * head_ref ) { int retval = -1 ; node_t * next_node = NULL ; if ( * head == NULL ) { return -1 ; } next_node = ( * head_ref ) -> next ; retval = ( * head_ref ) -> val ; free ( * head_ref ) ; * head_ref = next_node ; return retval ; }
This function pops out the first node of the list and
return its value.
This function pops out the first node of the list and return its value .