We generally have a habit of writing programs, and writing functions like writing functions to the front of the main function,
Commonly used in the formulation:
#include <iostream>
using namespace std;
void A ()
{
cout<< "function a\n";
}
void B ()
{
cout<< "function b\n";
}
int main ()
{
A ();
B ();
return 0;
}
Run Result:
It's normal to look right now, isn't it? The running result is also true, our general definition function is accustomed to write like this, thought that does not need to declare the function.
So now we look at this program changes after this source code is not still can do this? Without declaring it?
#include <iostream>
using namespace std;
void A ()
{
cout<< "function a\n";
B ();
}
void B ()
{
cout<< "function b\n";
A ();
}
int main ()
{
A ();
B ();
return 0;
}
This program does not declare an error before declaring it, because there is no statement.
This column more highlights: http://www.bianceng.cnhttp://www.bianceng.cn/Programming/net/