29 lines
1.1 KiB
C
29 lines
1.1 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_max.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: gtertysh <marvin@42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2016/11/04 10:45:30 by gtertysh #+# #+# */
|
|
/* Updated: 2016/11/04 11:04:53 by gtertysh ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
int ft_max(int *tab, int length)
|
|
{
|
|
int i;
|
|
int max;
|
|
|
|
i = 1;
|
|
if (length == 0)
|
|
return (0);
|
|
max = tab[0];
|
|
while (i < length)
|
|
{
|
|
if (tab[i] > max)
|
|
max = tab[i];
|
|
i++;
|
|
}
|
|
return (max);
|
|
}
|