A name must be declared before it can be used by the rest of the program. If main is first:
Code:
int main()
{
mult ( 2, 2 );
}
int mult ( int x, int y )
{
...
}
Then main has no idea what mult is because mult is declared after main. To fix this you make sure that mult exists before main either by declaring mult with a prototype:
Code:
int mult ( int x, int y );
int main()
{
mult ( 2, 2 );
}
int mult ( int x, int y )
{
...
}
Or by declaring mult before main with a definition:
Code:
int mult ( int x, int y )
{
...
}
int main()
{
mult ( 2, 2 );
}