In your file1.c
, it seems the declaration of void *foo()
is missing.
You can either include the header file containing this declaration or add line void *foo()
on top of file1.c
.
When compiler finds symbol foo
followed by (
in main file, and there was no declaration, it assumes foo
accepts any number of arguments and returns an int. So you see the warning that int
is being converted to a pointer.
But in file file3.c
, symbol foo
is known as it is a defined function before its first usage so compiler knows that foo
returns a pointer and thus no warning.