Should the function prototype in C be in main or before main. I was taught before main, but my friends class book shows it in main. Which is the correct way?
His book shows it:
int main()
{
void numberTable();
numberTable();
}
void numberTable()
{
int num;
...rest of the code...
}
Both are correct.
If you add the function declaration inside main, its scope is inside the main {
}
.
If you add it outside main, its scope is the entire source file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With