-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrules_1_bonus.c
55 lines (49 loc) · 1.85 KB
/
rules_1_bonus.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* rules_1_bonus.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: admansar <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/12/21 16:39:30 by admansar #+# #+# */
/* Updated: 2023/03/30 02:19:35 by admansar ### ########.fr */
/* */
/* ************************************************************************** */
#include "push_swap.h"
//switch the first two in a, no need to affect
// seg fault means that you wanted to
// swap one element thats a useles task !!
char **sa_bonus(char **c)
{
switch_1_2(c);
return (c);
}
//switch the first two in b, no need to affect
// seg fault means that you wanted to
// swap one element thats a useles task !!
char **sb_bonus(char **c)
{
switch_1_2(c);
return (c);
}
//switch a and b in the same time
// seg fautls means that you wanted to
// switch one element thats a usels task !!
void ss_bonus(char ***c1, char ***c2)
{
*c1 = switch_1_2(*c1);
*c2 = switch_1_2(*c2);
}
// prend le premier valeur dans le premier tableau
// et l'affecte au deuxieme tableau
// atention !!! passage par adress
void pb_bonus(char ***a, char ***b)
{
*b = ft_str_pro_cpy(NULL, first_to_first(*a, *b));
*a = ft_str_pro_cpy(NULL, ecrase_avant(*a));
}
void pa_bonus(char ***b, char ***a)
{
*b = ft_str_pro_cpy(NULL, first_to_first(*a, *b));
*a = ft_str_pro_cpy(NULL, ecrase_avant(*a));
}