Consider the next piece of code:
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
int printf(const char *format, ...)
{
va_list args;
return 1;
}
int main()
{
printf("Hello there");
return 0;
}
And indeed, printf
prints nothing. Meaning, the compiler 'prefer' this function over the one declared in <stdio.h>
. But C doesn't allow function overriding, and from my understanding, it should throw an error of conflicting errors.
Can anyone explain this behavior?