Variable C parameter: gcc-g-wall-O0 fuck. C-O fuck
# Include < Stdlib. h > /* Description: malloc, null, size_t */
# Include < Stdarg. h > /* Description: VA _ correlation type and Function */
# Include < String . H > /* Description strcat */
char * vstrcat ( const char * first ,...)
{< br> size_t Len;
char * retbuf;
va_list argp;
char * P;
If(First=Null)
ReturnNULL;
Len=Strlen (first );
Va_start (argp, first );
While(P=Va_arg (argp,Char *))! =Null)
Len+ =Strlen (P );
Va_end (argp );
Retbuf=Malloc (Len+ 1);/*+ 1 contains the delimiter \ 0*/
If(Retbuf=Null)
ReturnNULL;/*Outbound bytes*/
(Void) Strcpy (retbuf, first );
Va_start (argp, first );/*Start a new scanner*/
While(P=Va_arg (argp,Char *))! =Null)
(Void) Strcat (retbuf, P );
Va_end (argp );
ReturnRetbuf;
}
Int
Main ()
{
Char * Str = Vstrcat ( " Hello, " , " World! " , " 123 " , " Wo " );
Printf ( " % S \ n " , STR );
Return 0;
}/*---------- End of function main ----------*/