-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_sort_integer.c
36 lines (33 loc) · 1.15 KB
/
ft_sort_integer.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_sort_integer.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dbaldy <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2015/11/29 19:00:34 by dbaldy #+# #+# */
/* Updated: 2015/11/30 12:18:52 by dbaldy ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_sort_integer(int *tab, size_t size)
{
size_t i;
int a;
if (size < 2)
return ;
while (size--)
{
i = 0;
while (i < size)
{
if (tab[i] > tab[i + 1])
{
a = tab[i + 1];
tab[i + 1] = tab[i];
tab[i] = a;
}
i++;
}
}
}