0x10. C Variadic functions Task 3 - humtej1204/holbertonschool-low_level_programming GitHub Wiki

3. To be is a to be the value of a variable

mandatory

Write a function that prints anything.

  • Prototype: void print_all(const char * const format, ...);
  • where format is a list of types of arguments passed to the function
    • c: char
    • i: integer
    • f: float
    • s: char * (if the string is NULL, print (nil) instead
    • any other char should be ignored
    • see example
  • You are not allowed to use for, goto, ternary operator, else, do ... while
  • You can use a maximum of
    • 2 while loops
    • 2 if
  • You can declare a maximum of 9 variables
  • You are allowed to use printf
  • Print a new line at the end of your function
julien@ubuntu:~/0x0f. Variadic functions$ cat 3-main.c
#include "variadic_functions.h"

/**
 * main - check the code
 *
 * Return: Always 0.
 */
int main(void)
{
    print_all("ceis", 'B', 3, "stSchool");
    return (0);
}
julien@ubuntu:~/0x0f. Variadic functions$ gcc -Wall -pedantic -Werror -Wextra -std=gnu89 3-main.c 3-print_all.c -o d
julien@ubuntu:~/0x0f. Variadic functions$ ./d 
B, 3, stSchool
julien@ubuntu:~/0x0f. Variadic functions$ 

Repo:

  • GitHub repository: holbertonschool-low_level_programming
  • Directory: 0x10-variadic_functions
  • File: 3-print_all.c