In Java a class needs to be known before it can be used. Java uses the "import" statement for this purpose. Importing a class allows the compiler to match the intended use against the class definition and prevent stupid bugs already at compile time.
C functions need to be declared as well before they can be used. Because functions are usually called from a different location than their own file this declaration is best put in a place where everybody can get to it: a header file:
in Example.h:
int max(int, int); // simply declares max as taking two integer
// parameter and returning an integer
in Example.c:
void example(void) {
int result = max(4,5);
}
int max(int one, int two) {
return (one < two? two: one);
}
Using max from a different module (file):
#include "Example.h" // "imports" the declaration
void someFunction(void) {
int result = max(200,100);
.....
}
While this seems almost a no brainer one has to remember that C initially did not have function prototypes