Q:

Reasons for C++ Prototyping

I'm a beginning programmer, trying to get a grasp on everything, so pardon the probably mundane theoretical question:
I see in a C++ tutorial that prototyping is needed to let the compiler know that a function(?) is coming up and not to throw up any errors.  Why does it not search throughout a document to find the function it's looking for?
Maybe the question I'm asking is; what is the purpose for prototyping?  And can it be used in other languages?

A:

The reason is that you can use the function outside of the file where you implemented it. In this case searching throughout a document won't help because the compiler won't find it, yet it has to know the definitions of the function in order to enforce the typing and to encode the function name correctly for the linker to match it to the implementation.
It can be multilingual, C++ code can include direct calls to C functions (or any other language that adheres to C conventions when compiling the source code), which have to be declared as extern "C".

