Functions | Sololearn: Learn to code for FREE!



Every valid C++ program has at least one function - the main() function?

7 Answers

New Answer



Check my codes there is one which can run even without main(). Happy Coding.



can you really write computer software including databases with this course


Yes. It's the core code of the program and it has to have a return value. I'ts like a car can't be a car without engine, or wheels.


Technically compilers do provide some options to define a custom main function. Some engines and API's actually use this feature, for instance C/C++ programs that use the Windows API usually define WinMain as the entry point. Functionally there's no difference though. Every program needs an entry point (unless it's a library) and that entry function needs to have certain optional arguments depending on platform.


Yes.the main() function is the core code of the program