Now, the aim of the program is to take four names through a variable argument list and concatenate them using vsprintf() into a single string called ‘total’. As the program currently is, only the first name appears in string ‘total’. How can I solve this problem please? Thanks 🙂
Share
Signature is
int vsprintf(char *str, const char *format, va_list ap);.The second argument is the usual
printfformat string… so:This of course only works with exactly 4 strings, but you requested to implement this with
vsprintf, which doesn’t work for the generic case.Note: you’re missing
<stdio.h>, and it’sint main().