Is this possible to write a variable argument macro like this:
#include <stdio.h>
#include <stdarg.h>
#define func(x, ...)\
{\
va_list ap;\
va_start(ap, x);\
int y = va_arg(ap, int);\
printf("y is %d\n",y);\
}\
int main()
{
int x;
func(5, 4);
return 0;
}
I found an interview question which asked how to write a variable argument macro so I gave it a try. I am getting compile error though.