The prototype tells the compiler that there is a function that looks like this, and that is its name int getanint() . When you use this function, the compiler places code calls that function, and leaves room for the address to be inserted into the code that defines what this function does.
So, in the file header A;
int getanint();
IN main.c
int main(...) { getanint(); }
when you compile main.c, it does not know what getanint does or even where it is created .o file is incomplete and not enough to create the actual program. remember that the compiler works with one file, this file can be very large due to the #include directives, but they create one file.
When you execute A.cpp
int getanint() { return 4; }
You now have the code for getanint in the object file.
To actually create a program, you must get main.o and Ao together and have function definitions inserted in the appropriate places. This is the task of the linker.
rerun source share