+ 1
Can you declare functions after the main () or it should be only be declared before main() so that it can be invoked
2 ответов
+ 4
You seem to be asking about C++.
If you define them in one run, you have to define them before they are used: above main.
int f(int n) {//whatever code}
int main() {...
In C(++), you have the possibility to separate the declaration from the definition. If you do this, you can put only the declararion on top, and the definition can follow after main.
int f(int);
int main() {...}
int f(int n) {//And now the actual definition}
0
You can declare functions everywhere. At least at Java and C#