Hi,
This is abhinay,
I always suffered with following questions,
I red many docs but I could't gets its proper answer,
if u can help me then plz......
thanks in advance.
My questions are:
1. Which code or process is responsible for first call to main() in C/C++ programs.?
2. main() is user defined function still why main() is geting called first. ?
3. Which doc should i read for detailed information.
Thanks
Abhinay
1: The code that starts running first is the 'startup code'. Traditionally it's called
'c0' (unixes) or 'crt0' (MS windows). The code does some initialization work
and then basically performs this action:
i.e. it takes the return value of main and returns the completion status back to
the os again (which called c0 or crt0).
2: The startup code expects your code to supply a main() method.
3: any good book or manual for C/C++ compilers should give you all the info.
If you're working on a unix platform check the man pages.
kind regards,
Jos