Skip to content

Commit 8606271

Browse files
committed
fix bug
1 parent 3d8b52d commit 8606271

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

0x10-variadic_functions/1-print_numbers.c

+1-7
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,11 @@ void print_numbers(const char *separator, const unsigned int n, ...)
1414
unsigned int index;
1515
va_list ptr;
1616

17-
if (separator == NULL)
18-
{
19-
printf("\n");
20-
return;
21-
}
22-
2317
va_start(ptr, n);
2418
for (index = 0; index < n; index++)
2519
{
2620
printf("%i", va_arg(ptr, int));
27-
if (index != n - 1)
21+
if (index != n - 1 && separator != NULL)
2822
printf("%s", separator);
2923
}
3024
va_end(ptr);

0 commit comments

Comments
 (0)