mirror of
https://github.com/TheAlgorithms/C
synced 2024-11-22 05:21:49 +03:00
parent
b1fed3cf3e
commit
8e5f2ea3f9
@ -88,6 +88,7 @@ void push(int x) {
|
||||
tmp->data = x;
|
||||
tmp->next = NULL;
|
||||
tmp->pre = head;
|
||||
head->next = tmp;
|
||||
head = tmp;
|
||||
}
|
||||
++count;
|
||||
@ -104,8 +105,10 @@ int pop() {
|
||||
} else {
|
||||
returnData = head->data;
|
||||
|
||||
if(head->pre == NULL)
|
||||
if(head->pre == NULL){
|
||||
free(head);
|
||||
head = NULL;
|
||||
}
|
||||
else {
|
||||
head = head->pre;
|
||||
free(head->next);
|
||||
|
Loading…
Reference in New Issue
Block a user