-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update lst->content, (char *) -> (int *)
- Loading branch information
Showing
2 changed files
with
13 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
/* By: reasuke <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2024/01/11 19:04:40 by reasuke #+# #+# */ | ||
/* Updated: 2024/01/12 15:42:34 by reasuke ### ########.fr */ | ||
/* Updated: 2024/01/15 12:56:26 by reasuke ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
@@ -93,13 +93,18 @@ t_list *generate_stack(int argc, char **argv) | |
t_list *stack; | ||
int *compressed_array; | ||
int i; | ||
int *ptr; | ||
|
||
compressed_array = _coordinate_compression(argc, argv); | ||
i = 0; | ||
stack = NULL; | ||
while (i < argc - 1) | ||
{ | ||
ft_lstadd_back(&stack, ft_lstnew(ft_itoa(compressed_array[i]))); | ||
ptr = ft_calloc(1, sizeof(int)); | ||
if (!ptr) | ||
exit_with_error(); | ||
*ptr = compressed_array[i]; | ||
ft_lstadd_back(&stack, ft_lstnew(ptr)); | ||
i++; | ||
} | ||
free(compressed_array); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
/* By: reasuke <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2024/01/12 15:58:22 by reasuke #+# #+# */ | ||
/* Updated: 2024/01/12 16:17:00 by reasuke ### ########.fr */ | ||
/* Updated: 2024/01/15 12:58:12 by reasuke ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
@@ -17,8 +17,8 @@ static void _handle_2(t_list *stack) | |
int first; | ||
int second; | ||
|
||
first = ft_atoi(stack->content); | ||
second = ft_atoi(stack->next->content); | ||
first = *(int *)stack->content; | ||
second = *(int *)stack->next->content; | ||
if (first > second) | ||
ft_putendl_fd("sa", STDOUT_FILENO); | ||
} | ||
|
@@ -29,9 +29,9 @@ static void _handel_3(t_list *stack) | |
int second; | ||
int third; | ||
|
||
first = ft_atoi(stack->content); | ||
second = ft_atoi(stack->next->content); | ||
third = ft_atoi(stack->next->next->content); | ||
first = *(int *)stack->content; | ||
second = *(int *)stack->next->content; | ||
third = *(int *)stack->next->next->content; | ||
if (first == 2 && second == 1 && third == 3) | ||
ft_putendl_fd("sa", STDOUT_FILENO); | ||
else if (first == 3 && second == 2 && third == 1) | ||
|