what is the role of main() in cpp? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 3

what is the role of main() in cpp?

Please help me how important role is main function in cpp.

15th Aug 2020, 2:38 PM
Abhishek Kumar
Abhishek Kumar - avatar
3 Respostas
+ 9
It's simply a entry point where actually exicution of the program begins.. irrespective of number of methods u included! TheĀ mainĀ function is called at program begining afterĀ initializationĀ of the non-local objects with staticĀ storage duration. It is the designated entry point to a program that is executed inĀ hostedĀ environment (OS). The entry points toĀ freestandingĀ programs are implemented defined.
15th Aug 2020, 2:45 PM
chaithra Gowda
chaithra Gowda - avatar
+ 2
it is just an entry point to execute a program. os need to know where to start a program
15th Aug 2020, 2:45 PM
durian
durian - avatar
0
Abhishek Kumar This is called function. Any code inside its curly brackets {} will be executed. main() function is the starting point of any C++ program
20th Jun 2021, 5:54 PM
Sujuma
Sujuma - avatar