42_C_PISCINE/C/c01v3/ex07/ft_rev_int_tab.c
Camille Chauvet 29ed24d567 init
2023-05-17 16:45:25 +00:00

33 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_rev_int_tab.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/15 09:31:51 by cchauvet #+# #+# */
/* Updated: 2022/07/15 10:54:35 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
void ft_swap(int *a, int *b)
{
int tempo;
tempo = *a;
*a = *b;
*b = tempo;
}
void ft_rev_int_tab(int *tab, int size)
{
int i;
i = 0;
while (i < size / 2)
{
ft_swap(tab + i, tab + size - i - 1);
i++;
}
}