Do i have to have a main function?
If i don't have a function called main,i get erors.Why do i have to
have a function called main?
You don't have to. At least some compilers let you specify the entry point
(like Visual C++ for example). If you're not overriding the entry point
though, then you'll have to have a main. The entry point though is not
really main but some other function in the runtime library that calls main.
If you change the entry point, you can't use the C++ libraries because they
won't be initialized. Other things such as destruction of global objects
with constructors won't work unless you find a way to do so (not too hard).
I don't have an exhaustive list of the things you'll encounter on every
platform. Note that I have done this (created my own entry point) on the
WinTel platform and it was very instructional. I didn't figure it out as
much as I just did the research on the web on how to do it. I got into that
while trying to wittle down executable sizes to the minimum.
John