3.3.1.5 How Can I Use A Function Defined In Another Source File?
Provided the function defined in the other source file is not
static
, then adding a declaration (as opposed to a definition) for that
function into the current file will allow you to call it. A declaration optionally consists
of the keyword extern
in addition to the exact function prototype. You can
omit the names of the parameters in the declaration. If you include the parameter names,
they should match the definition. For example:
extern int readStatus(int); // declare readStatus for use here
This storage-class specifier is part of the C language, and your favorite C textbook will provide more information on its usage.
Often, declarations are placed in header files and then they are
#include
d into the C source code (see 5.14.1 Preprocessor Directives).