J'avance
This commit is contained in:
parent
825b4f85b5
commit
89c4b4ee44
23
push_swap.c
23
push_swap.c
|
@ -15,7 +15,7 @@
|
|||
|
||||
#include <stdio.h>
|
||||
|
||||
void get_index(int **tab)
|
||||
void get_index(int **tab,int len)
|
||||
{
|
||||
int i;
|
||||
int y;
|
||||
|
@ -27,10 +27,10 @@ void get_index(int **tab)
|
|||
min = *tab[0];
|
||||
old_min = *tab[0];
|
||||
new_index = 0;
|
||||
while (*tab[++i] != NULL)
|
||||
while (++i < len)
|
||||
{
|
||||
y = -1;
|
||||
while (*tab[++y] != NULL)
|
||||
while (++y < len)
|
||||
{
|
||||
if (*tab[y] < min && *tab[y] <= old_min)
|
||||
{
|
||||
|
@ -40,18 +40,15 @@ void get_index(int **tab)
|
|||
old_min = min;
|
||||
}
|
||||
}
|
||||
for (i = 0 ; tab[i] != NULL ; i++)
|
||||
for (i = 0 ; i < len ; i++)
|
||||
{
|
||||
printf("%d", tab[i]);
|
||||
printf("%d", *tab[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void push_swap(int *tab, int argc)
|
||||
void push_swap(int *tab, int len)
|
||||
{
|
||||
int *index;
|
||||
|
||||
index = malloc(sizeof(int) * (argc + 1));
|
||||
get_index(&tab);
|
||||
get_index(&tab, len);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
|
@ -59,11 +56,10 @@ int main(int argc, char *argv[])
|
|||
int *tab;
|
||||
int i;
|
||||
int y;
|
||||
int test;
|
||||
|
||||
tab = malloc(sizeof(int) * (argc + 1));
|
||||
i = 0;
|
||||
y = 0;
|
||||
tab = malloc(sizeof(int) * (argc + 1));
|
||||
if (argc > 1)
|
||||
{
|
||||
while (++i < argc)
|
||||
|
@ -76,8 +72,7 @@ int main(int argc, char *argv[])
|
|||
return (1);
|
||||
}
|
||||
}
|
||||
tab[y] = NULL;
|
||||
get_index(&tab);
|
||||
get_index(&tab, y);
|
||||
//push_swap(tab, argc);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue