42_C_PISCINE/C/c01v1/ex07/ft_rev_int_tab.c

33 lines
1.1 KiB
C
Raw Normal View History

2023-05-17 12:45:25 -04:00
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* 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++;
}
}