/******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby,
C#, VB, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS
Code, Compile, Run and Debug online from anywhere in world.
*******************************************************************************/
#include <stdio.h>
#include <stdarg.h>
char *concat(char *s1, ...)
{
char *saved = s1;
char *s2;
va_list ap;
va_start(ap, s1);
if(s1)
{
while(*s1) s1++;
while((s2 = va_arg(ap, char *))) while(*s2) *s1++ = *s2++;
}
va_end(ap);
return saved;
}
int main()
{
char s1[64] = "Hello";
printf("%s\n", concat(s1," World", " !12345!", " QWWERTY ", "@@", NULL));
return 0;
}