If I defined a variadic function:
#include <stdio.h>
#include <stdarg.h>
int f(char*s,...)
{
va_list ap;
int i=0;
va_start(ap, s);
while(s)
{
printf("%s ", s);
i++;
s=va_arg(ap,char*);
}
va_end(ap);
return i;
}
int main()
{
return f("a","b",0);
}
gcc (linux x64) compiles this and the exe runs and prints "a b ".
is there any need for a cast like:
return f("a","b",(char*)0)
on common systems?