anonymous
2007-11-13 02:28:14 UTC
#include
#include
int mul(int d,...)
{
va_list vList;
va_start(vList,d);
int num;
num = va_arg(vList,int);
while(num != NULL)
{
printf("\n[%d]",num);
num = va_arg(vList,int);
}
va_end(vList);
}
int main()
{
mul(1,2,3,4,5,NULL);
}
To identify the ending of list, i check the argument against NULL - (while loop)
but the problem is if i give 0 as the first argument, it is terminating prematurely.
why is it that 0 and NULL behave similarly?
what is the difference b/w the two?Exemplify if you can.