This may have been covered, if so, apologies, but is anyone able to give a full explanation on why the main() function of any C++ program is always of type int? C# main functions are of type void() and work just the same.
Thanks
In C# you also can have int main()
and return the exit code of the process, and void main()
means exit code is 0 (i.e. program ended normally). In C++ while you cannot have void main()
you still can skip the return 0;
at the end if you donβt want to type it yourself.
1 Like