code:
// n = 2
void fun(int n, ...){
va_list ap;
int i;
char *arg1 = (char *) malloc(MAX * sizeof(char));
char *arg2 = (char *) malloc(MAX * sizeof(char));
va_start(ap, n);
memset(arg1,0,MAX);
memset(arg2,0,MAX);
arg1 =(char*)va_arg(ap,char*);
arg2 =(char*)va_arg(ap,char*);
fprintf(stdout,"%s",strcat(arg1,arg2);
va_end(ap);
}
problem: strcat dont concatenate the two arguments, help!!
// n = 2
void fun(int n, ...){
va_list ap;
int i;
char *arg1 = (char *) malloc(MAX * sizeof(char));
char *arg2 = (char *) malloc(MAX * sizeof(char));
va_start(ap, n);
memset(arg1,0,MAX);
memset(arg2,0,MAX);
arg1 =(char*)va_arg(ap,char*);
arg2 =(char*)va_arg(ap,char*);
fprintf(stdout,"%s",strcat(arg1,arg2);
va_end(ap);
}
problem: strcat dont concatenate the two arguments, help!!