0
Is it compulsory to write int main instead of void main while recursion?
4 Answers
+ 4
main function by standard does return int, old compilers may accept main to return void, but it's just non-standard. And although it is possible, it is not considered a good design to have a code that enters main function recursively, one can design a loop within main to repeat a certain task rather than calling the main again to go round and round.
Further detailed explanation can be followed on these links:
https://stackoverflow.com/questions/204476/what-should-main-return-in-c-and-c
https://www.codesdope.com/blog/article/int-main-vs-void-main-vs-int-mainvoid-in-c-c/
+ 3
At least identify which language in "Relevant Tags" to prevent confusions for those who wants to respond. Thanks ...
0
I don't think so. Write int if it's returning an integer or void if it returns nothing.
0
Ipang it's 'C'
so please give it ans .