-
Notifications
You must be signed in to change notification settings - Fork 0
/
free_stack.c
28 lines (25 loc) · 1.09 KB
/
free_stack.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* free_stack.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rlucio-l <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/05/31 00:18:50 by rlucio-l #+# #+# */
/* Updated: 2022/05/31 01:00:11 by rlucio-l ### ########.fr */
/* */
/* ************************************************************************** */
#include "push_swap.h"
void free_stack(t_node *stack_head)
{
t_node *node;
t_node *next;
node = stack_head->next;
while (node != stack_head)
{
next = node->next;
free(node);
node = next;
}
free(stack_head);
}