tgrekov-push_swap
HIVE push_swap July 2024
Loading...
Searching...
No Matches
main.c
Go to the documentation of this file.
1/* ************************************************************************** */
2/* */
3/* ::: :::::::: */
4/* main.c :+: :+: :+: */
5/* +:+ +:+ +:+ */
6/* By: tgrekov <tgrekov@student.hive.fi> +#+ +:+ +#+ */
7/* +#+#+#+#+#+ +#+ */
8/* Created: 2024/07/06 04:07:48 by tgrekov #+# #+# */
9/* Updated: 2024/07/16 12:26:16 by tgrekov ### ########.fr */
10/* */
11/* ************************************************************************** */
12
20#include <stdlib.h>
21#include "stack/stack.h"
22
23int input(int argc, char **argv, t_stack *stack);
24int sort(t_stack *stack);
25
26int main(int argc, char **argv)
27{
28 int status;
29 t_stack stack[2];
30
31 if (argc == 1)
32 return (0);
33 stack[0].n = 0;
34 stack[1].n = 0;
35 status = input(argc, argv, stack);
36 if (!status)
37 status = sort(stack);
38 free(stack[0].n);
39 free(stack[1].n);
40 return (status);
41}
int sort(t_stack *stack)
Output all instructions required to sort stack a.
Definition sort.c:148
int input(int argc, char **argv, t_stack *stack)
Parse and validate program input, initialize stacks and fill the first stack.
Definition input.c:134