ProAnswers.org

What does extern mean in a function declaration?

It refers to a variable which is not actually in your program. For instance,

main() {
    extern int bar;
    printf("%d\n", bar);
    return 0;
}

will compile without errors because bar is declared as being external. (It won’t run, though, because you never assign bar a value.)

Using extern in a function declaration we can make a function such that it can used outside the file in which it is defined.

An extern variable, function definition, or declaration also makes the described variable or function usable by the succeeding part of the current source file. This declaration does not replace the definition. The declaration is used to describe the variable that is externally defined.

If a declaration for an identifier already exists at file scope, any extern declaration of the same identifier found within a block refers to that same object. If no other declaration for the identifier exists at file scope, the identifier has external linkage.