-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_add.c
31 lines (28 loc) · 1.07 KB
/
ft_add.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_add.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: phemsi-a <phemsi-a@student.42sp.org.br> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/03/01 13:39:51 by phemsi-a #+# #+# */
/* Updated: 2021/05/10 23:57:35 by phemsi-a ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_add(int args, ...)
{
va_list ap;
int i;
int sum;
va_start(ap, args);
i = 0;
sum = 0;
while (i < args)
{
sum += va_arg(ap, int);
i++;
}
va_end(ap);
return (sum);
}