3 ms·
In a fixadic function the integer literal would be promoted to a pointer, because the caller knows that the argument should be a pointer. In a variadic function
by colonwqbang 7y ago
In a fixadic function the integer literal would be promoted to a pointer, because the caller knows that the argument should be a pointer. In a variadic function call, the caller guesses the type of each argument based on what is passed. A variadic function needs to know exactly the size of its arguments and sizeof(int) != sizeof(pointer) on many systems.
This works:
void f(char *p);
f(0); /* integer literal auto promoted to pointer */
This probably doesn't, at least not as the number of arguments to f is increased:
void f(...);
f(0); /* assume type of function is void f(int) */