- Hour 13. Developing Advanced References and Pointers
- from Sams Teach Yourself C++ in 24 Hours, fifth edition
- Publisher: Sams
- Released: April 2011
This is a function definition.
A definition can be used in the place of a declaration.
An identifier can be declared as often as you want. Thus, the following is legal in C and C++:
double f(int, double); double f(int, double); extern double f(int, double); // the same as the two above extern double f(int, double);
However, it must be defined exactly once. If you forget to define something that's been declared and referenced somewhere, then the linker doesn't know what to link references to and complains about a missing symbols. If you define something more than once, then the linker doesn't know which of the definitions to link references to and complains about duplicated symbols.
Share this highlighthttp://www.safaribooksonline.com/a/sams-teach-yourself/73133/