So my understanding is that you MUST have prototypes before function usages in all files where the functions are used. But then why does this still work!?
# MAIN.C
int main() {
hello();
}
# HELLO.C
#include <stdio.h>
void hello() {
printf("Hello\n");
}
In main.c
, there is no prototype for hello()
anywhere but when I compile the program with gcc -o hello main.c hello.c
and run the hello
executable, everything seems to work just fine. I'm guessing that in a more complex example something would begin to go wrong, but I don't understand when and why.