I'm creating a modified printf implementation, and I'm not sure about the answers to these questions.
Does zero work as a null string? (Is
printf("%s", 0)
allowed?)I'm guessing no, because 0 is an
int
. But then this prompts this question:Does
NULL
work as a null string? (Isprintf("%s", NULL)
allowed?)Logically, I think it should be yes, because
NULL
implies a pointer; but a lot of implementations seem to have#define NULL 0
, so I feel in practice it might be no. Which is correct?Does the pointer type have to point to
char
? (Isprintf("%s", (void const *)"")
allowed?)My guess is that the type doesn't matter, but I'm not sure.