init
This commit is contained in:
32
Correction/gpouzet/ex07/ft_rev_int_tab.c
Normal file
32
Correction/gpouzet/ex07/ft_rev_int_tab.c
Normal file
@ -0,0 +1,32 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* 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++;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user