May 2002
Beginner
320 pages
6h 18m
English
C++ requires that you declare everything before you use it. Thus, a function must be declared before it is used in another function. Because of this, the functions called by main() are typically placed in the space above main() in C++ programs. Functions used by a function called from main() are defined above that function, as shown here:
void A(void)
{
}
void C(void)
{
}
void D(void)
{
}
void B(void)
{
C();
D();
}
main()
{
A();
B();
}
Declaring is not always the same thing as defining. Some older C and C++ programs use function prototypes to declare a function without defining it.
A prototype is a function header with no body. It ends with a semicolon. Modern programs rarely, if ever, should use a function prototype. ...
Read now
Unlock full access