#include <stdio.h>
#include <stdarg.h>
#include <string.h>
void concat (char * des,...)
{
char* str;
va_list args;
va_start (args, des);
strcpy(des,"");
str=va_arg(args, char *);
while (str)
{
strcat(des,str);
str=va_arg(args, char *);
}
va_end(args);
//strcat(str,"\0");
//return des;
}
int main()
{
char des[120];
concat(des, "Hello", " ","I"," ","am"," ","here!",NULL);
printf("%s\n",des);
return 0;
}
No comments:
Post a Comment