Here, each function calls the other - I removed all the controlling logic to focus on the issue.
1 2 3 4 5 6 7 8 9
|
int norcliffCentre()
{
norcliffMarket();
}
int norcliffMarket()
{
norcliffCentre();
}
|
At line 8, the call to norcliffCentre() is ok, as it is defined previously.
On the other hand, at line 3, the call to norcliffMarket() doesn't work as the compiler at that stage is not aware of the existence of that function, since it is defined later.
The solution is to declare a prototype:
1 2 3 4 5 6 7 8 9 10 11
|
int norcliffMarket(); // prototype declaration
int norcliffCentre()
{
norcliffMarket();
}
int norcliffMarket()
{
norcliffCentre();
}
|
The declaration at line 1 gives the compiler the basic information it requires about the function, that is the name, return type (int) and parameter list (none).
The actual code for the function is defined lower down, but that's ok now. (As was mentioned, the actual function definition could even be in a separate file).