Programs written after main function | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Programs written after main function

Programs including user defined functions https://code.sololearn.com/cL7xOo3Xac47/?ref=app

27th Nov 2017, 4:06 PM
Samarth H Chinivar
Samarth H Chinivar - avatar
3 Answers
+ 5
Is there a question?
27th Nov 2017, 4:10 PM
Kirk Schafer
Kirk Schafer - avatar
+ 2
https://code.sololearn.com/c3C8K6czpN2O/?ref=app this is anathor one like which gives out cubes
27th Nov 2017, 4:07 PM
Samarth H Chinivar
Samarth H Chinivar - avatar
+ 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; }
27th Nov 2017, 7:48 PM
Zeke Williams
Zeke Williams - avatar