Reputation: 11
I have an array of strings and string representing the format for a printf statement. The number of strings in the array can vary, as can the format string (to match the number of strings in the array). Is there a way in C to print an array with a single format statement? I thought I'd be able to accomplish this with variadic functions, but there doesn't seem to be a way to pass an array as the args into va_list.
char mystring[3][20] = {"one", "two", "three"};
char format[] = "%-25s%-30s%s\n";
Upvotes: 0
Views: 215