Can we declare main function under user defined function in c++? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Can we declare main function under user defined function in c++?

eg void myfunction(){ int main(){ ----------- -------- return 0; } }

16th Jun 2018, 11:43 AM
Dipen Luitel
Dipen Luitel - avatar
3 Answers
+ 2
no, you cant have nested functions in c++
16th Jun 2018, 11:55 AM
Max
Max - avatar
+ 2
No
17th Jun 2018, 7:56 AM
Shahil Ahmed
Shahil Ahmed - avatar
0
No
16th Jun 2018, 1:58 PM
Aveek Bhattacharyya
Aveek Bhattacharyya - avatar