The main() function

The main() function doesn’t really mean anything on it’s own.

It’s just a line of code you put at the beginning of what may well be longer lines of code.

That first line of code is what tells the computer that what follows may be those longer lines of code and that it’s those longer lines of code that define every line of code.

1 Like

Hi and Welcome to the community.

The main function does do something very important. It is the first function in ant C++ program to be called regardless of what that program is. Even the Unreal Engine has a main function hidden away in its depths.

On its own with no additional code it does do nothing, but without a main function, C++ code won’t start either.

I hope this makes sense.

Good luck with the course. I hope you enjoy it.

Thank you

Privacy & Terms