The difference between the two statements is as follows:
extern void fun();
tells the compiler and linker to look in another file when the code in this file refers to fun (), possibly by calling fun (); This work is called a "declaration."
void fun ( ) { ... }
Defines the fun () function, and since it is defined in this file, eliminates the need for the linker to look for the function elsewhere.
There is no harm in declaring an extern function: the linker is doing the right thing.
source share