in Blog Posts, Solution

va_list

Just a reminder here.
For details please refer to page: http://www.delorie.com/gnu/docs/glibc/libc_675.html

void my_printf(const char *format_string, ...) {
     va_list arg_list; // a pointer to locate the begin of parameters
     va_start(arg_list, format_string); // the format_string is the last argument, arg_list points to the begin of parameters
     // ...
     // Set A Loop here to traverse along the arguments
     int a = va_arg(arg_list, int); // For example
     // ...
     va_end(arg_list); // Clean up
}

Write a Comment

Comment