-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_rev_int_tab.c
49 lines (44 loc) · 1.3 KB
/
ft_rev_int_tab.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
37
38
39
40
41
42
43
44
45
46
47
48
49
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_rev_int_tab.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: davgalle <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/07/13 18:21:38 by davgalle #+# #+# */
/* Updated: 2023/07/14 11:28:22 by davgalle ### ########.fr */
/* */
/* ************************************************************************** */
#include<unistd.h>
#include<stdio.h>
void ft_rev_int_tab(int *tab, int size)
{
int i;
int z;
int temp;
i = 0;
z = size - 1;
while (i < (size / 2))
{
temp = tab[i];
tab[i] = tab[z];
tab[z] = temp;
i++;
z--;
}
}
/*
int main(void)
{
int tab[] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
int size;
size = 9;
ft_rev_int_tab(tab, size);
size = 0;
while (size < 9)
{
printf("%d", tab[size]);
size++;
}
return (0);
}*/