Add all git folders
This commit is contained in:
34
C_Piscine_C_01/git/ex08/ft_sort_int_tab.c
Normal file
34
C_Piscine_C_01/git/ex08/ft_sort_int_tab.c
Normal file
@@ -0,0 +1,34 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_sort_int_tab.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: gbaconni <marvin@42lausanne.ch> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2021/08/09 14:23:41 by gbaconni #+# #+# */
|
||||
/* Updated: 2021/08/09 14:49:11 by gbaconni ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
void ft_sort_int_tab(int *tab, int size)
|
||||
{
|
||||
int i;
|
||||
int pass;
|
||||
int n;
|
||||
|
||||
pass = size - 1;
|
||||
while (pass--)
|
||||
{
|
||||
i = 0;
|
||||
while (i < size - 1)
|
||||
{
|
||||
if (tab[i] > tab[i + 1])
|
||||
{
|
||||
n = tab[i];
|
||||
tab[i] = tab[i + 1];
|
||||
tab[i + 1] = n;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user