What the main() Function does

Responding to a challenge from the C++ course by GameDev. I have a small amount of experience with programming in C++, though the course I took skipped a good amount of the basics and taught by throwing into the deep, but what I gathered about the main() function is that it is the focus of the program. Other functions can be referenced in main() to to build the program but it is all eventually sent to main() to be run from this function. In that way it is the function that is actually creating the program and others that may be created are building blocks that the main function uses within itself.

1 Like

Sort of right. Main is the first function that is executed in a C++ application. It can call other functions to do things and in fact, it may be that all code exists in those functions depending on how the application is organised. In the end, main is just another function but the key thing is in a standard application it will always be called once and once only.

I hope this helps.

1 Like

Posting about the little challenges on this course. I just wanted to mention that for what I understand about the “main function” is that it is the function that uses the functions that we create before. It contains the call for the function that we want to use and runs as the primary function . I might be wrong but this is just the beginning. Cheers!