-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsorted.c
29 lines (26 loc) · 1.11 KB
/
sorted.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
29
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* sorted.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: lstorey <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/20 12:22:45 by lstorey #+# #+# */
/* Updated: 2024/04/03 14:22:01 by lstorey ### ########.fr */
/* */
/* ************************************************************************** */
#include "push_swap.h"
int sorted(t_ps_list **stack)
{
t_ps_list *tmp;
if (!stack || !(*stack))
return (1);
tmp = (*stack);
while (tmp->next)
{
if (tmp->number > tmp->next->number)
return (1);
tmp = tmp->next;
}
return (0);
}