I've been making websites and odd projects with Python and Javascript for about 4 years, and now I'm making the leap down to C/C++ for a new endeavor. Forgive me if my terminology is off, still finding the right language for everything.
my understanding is that the function and type declarations in header files help create a symbol table for compilation, which allows you to reference those imported functions in a main() routine (or something similar) before you've actually linked to the definitions. When you 'declare' something, you're putting it in the symbol table, so the compiler can verify references from files that are using those imported functions.
So my questions is, why would you construct the symbol table for imported funcs/types from a separate header file, rather than derive it directly from the source code you're going to import? why not just scan the .c file you're going to import, gather the function and typedef names and use those to populate the symbol table? would save code (no declarations), and I think would make importing code a bit more intuitive.
That said, my guess is i'm missing something - I'm sure there's a reason for the way it's organized the way it is. Flexibility? independence of the interface? is it less work to scan a header file? I don't know.
any insight you might have would be greatly appreciated!