According to my teacher, this is a bad practice for writing custom functions like this:
int DoubleNumber(int Number)
{
return Number * 2;
}
int main()
{
cout << DoubleNumber(8);
}
Instead, he says that he always uses forward declarations, even if the functions do not need any knowledge of each other:
int DoubleNumber(int Number);
int main()
{
cout << DoubleNumber(8);
}
int DoubleNumber(int Number)
{
return Number * 2;
}
I find this particularly strange, as he told us how important it is that the declaration and implementation forward are exactly the same, or you get errors. If this is so important, why not just put everything higher main()?
So, is it really bad practice to declare and implement at the same time? Does it even matter?
Maxpm source
share