33 lines
1.1 KiB
C
33 lines
1.1 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_sstrsort.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2016/11/03 18:03:37 by jhalford #+# #+# */
|
|
/* Updated: 2017/03/23 14:40:25 by gwojda ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "libft.h"
|
|
|
|
void ft_sstrsort(char **list, int (*cmp)())
|
|
{
|
|
int i;
|
|
char *tmp;
|
|
|
|
i = 0;
|
|
while (list[i] && list[i + 1])
|
|
{
|
|
if ((*cmp)(list[i], list[i + 1]) > 0)
|
|
{
|
|
tmp = list[i];
|
|
list[i] = list[i + 1];
|
|
list[i + 1] = tmp;
|
|
i = 0;
|
|
}
|
|
else
|
|
i++;
|
|
}
|
|
}
|