0x10. C Variadic functions Task 2 - humtej1204/holbertonschool-low_level_programming GitHub Wiki
2. One woman's constant is another woman's variable
mandatory
Write a function that prints strings, followed by a new line.
- Prototype:
void print_strings(const char *separator, const unsigned int n, ...);
- where
separator
is the string to be printed between the strings - and
n
is the number of strings passed to the function - You are allowed to use
printf
- If
separator
isNULL
, don’t print it - If one of the string is
NULL
, print(nil)
instead - Print a new line at the end of your function
julien@ubuntu:~/0x0f. Variadic functions$ cat 2-main.c
#include "variadic_functions.h"
/**
* main - check the code
*
* Return: Always 0.
*/
int main(void)
{
print_strings(", ", 2, "Jay", "Django");
return (0);
}
julien@ubuntu:~/0x0f. Variadic functions$ gcc -Wall -pedantic -Werror -Wextra -std=gnu89 2-main.c 2-print_strings.c -o c
julien@ubuntu:~/0x0f. Variadic functions$ ./c
Jay, Django
julien@ubuntu:~/0x0f. Variadic functions$
Repo:
- GitHub repository: holbertonschool-low_level_programming
- Directory: 0x10-variadic_functions
- File: 2-print_strings.c