-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathis_it_sorted.c
34 lines (31 loc) · 1.27 KB
/
is_it_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
30
31
32
33
34
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_atoi.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: enoye <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/10/13 10:12:37 by enoye #+# #+# */
/* Updated: 2021/10/17 10:10:35 by enoye ### ########.fr */
/* */
/* ************************************************************************** */
#include "libpushswap.h"
int is_it_sorted(t_list **list)
{
int answer;
t_list *current;
t_list *nextlist;
answer = 1;
current = *list;
nextlist = (*list)-> next;
if ((*list)-> next == 0)
return (answer);
while (nextlist != 0 && (current -> content) < (nextlist -> content))
{
current = current -> next;
nextlist = nextlist -> next;
}
if (nextlist != 0)
answer = 0;
return (answer);
}