Created
July 29, 2019 19:40
-
-
Save devansh42/3ce385490750a9342fe3538045e0b568 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int pop_list(LinkedList* list){ | |
if(!list->head) return -1; //It means, linked list is empty | |
int value; //holds value of node | |
value=list->head->value; //accessing node | |
Node* head; //hold's address of the current header | |
head=list->head; | |
list->head=list->head->next; //making new header, the next node to the previous header | |
free(head); //freeing memory associated with previous header | |
list->length--;// Decreasing length of linked list | |
return value; //returning value of poped out node | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment