May 18th, 2013, 01:15 PM
While the statement is correct, I think they are confusing a simple issue.
I would say simply extern is required only to distinguish a data declaration
from a data instantiation
. For example:
extern int foo ; // declaration
int foo = 255 ; // instantiation (with initialiser)
extern int bar ; // declaration
int bar ; // instantiation (without initialiser)
extern is always explicit for a definition not within a function.
All that said, your book should hardly be encouraging teh use of global data declarations in any case. It is just poor practice.
extern is entirely unnecessary for function declarations, because these are distinguished from definitions by having no function body. They are deed for data declarations because a data declaration need not have an explicit initialiser.
Last edited by clifford : May 18th, 2013 at 01:19 PM.