-
Notifications
You must be signed in to change notification settings - Fork 0
/
push_swap.h
45 lines (39 loc) · 1.88 KB
/
push_swap.h
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
35
36
37
38
39
40
41
42
43
44
45
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* push_swap.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ana-lda- <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/26 15:05:43 by ana-lda- #+# #+# */
/* Updated: 2024/07/06 15:34:18 by ana-lda- ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef PUSH_SWAP_H
# define PUSH_SWAP_H
# include "libft/libft.h"
# include <limits.h>
# include <unistd.h>
# include <stdlib.h>
# include <stdio.h>
# include <stdbool.h>
typedef struct s_stack
{
int data; // the value of the node
int pos; // position of the node in the stack
int above_median; // flag to indicate if num is above median
int min_mov; // minimum moves required for operation
struct s_stack *target; // pointer to the target node
struct s_stack *next; // pointer to the next node in the list
struct s_stack *prev; // pointer to the previous node
} t_stack;
/*.....................HANDLE_ERRORS.....................*/
int error_int(int argc, char **argv);
int error_syntax(int agrc, char **argv);
int error_dup(char **argv);
t_stack *new_stack(char **str);
void free_str(char **lst);
void free_stack(t_stack **list);
int free_split(int argc, char **argv, bool flag);
int valid_imput(char **argv, int argc);
#endif