+ 2
Programs written after main function
Programs including user defined functions https://code.sololearn.com/cL7xOo3Xac47/?ref=app
3 Answers
+ 5
Is there a question?
+ 2
https://code.sololearn.com/c3C8K6czpN2O/?ref=app
this is anathor one like which gives out cubes
+ 1
If you're asking about functions being defined outside of the main function, then yes, this possible. You can also declare the function above main using a function prototype and then define the function below main as well.
int twoTimes(int n);
int main() {
cout << twoTimes(4) << endl;
return 0;
}
int twoTimes(int n) {
return 2 * n;
}