+ 2

What is the use of main() and why is it compulsory??đŸ€”

21st Oct 2021, 2:32 AM
John Lukose Cochettu
John Lukose Cochettu - avatar
5 Answers
+ 3
the main function is the driver code of the whole c++ program. It indicates the starting point of instructions when the program is executed.
21st Oct 2021, 2:57 AM
Danielle Bagaforo Meer
Danielle Bagaforo Meer - avatar
21st Oct 2021, 7:35 AM
Ipang
+ 1
In C++, the “main()” function is treated the same as every function. The only difference is that the main function is “called” by the operating system when the user runs the program. It is used as entry point of program. Every program starts execution from main() function. Like, other function it has also return type and parameters or signatures. By default, return type of main() in C programming language is void and for C++ is int.
21st Oct 2021, 4:59 AM
Arun Jamson
Arun Jamson - avatar
+ 1
The main is the first executable statement for every programming language From main we can call various userdefined functions or create code based on requirement
22nd Oct 2021, 8:59 AM
sree harsha
sree harsha - avatar