+ 6
Who calls the main() function ?
9 Answers
+ 4
Please know that compiler is just a tool,
It cant pass instruction on its own!!!
operating system only does those things
+ 3
the compiler or interpreter.
+ 2
compiler
+ 2
The operating system itself calls the main function after initializing of non local objects and it is the entry point to the program
+ 2
@ aklex
then can you explain how the program runs in cmd / terminal?
+ 1
COMPILER
+ 1
compiler acts as the intermediator for the os and our program
when a file is started to run the os calls the main function through compiler
- 2
To the people saying the operating system calls it, you are mistaken! The compiler does. Before main the compiler inserts runtime checks and prepares your application, then calls your main function. The operating system is only responsible for loading your program into memory and calling the actual part that is placed by your compiler. Not setting up the runtime a language needs and calling main directly