+ 6

Who calls the main() function ?

26th May 2017, 8:11 AM
Chandan Kumar Gouda
Chandan Kumar Gouda - avatar
9 Answers
+ 4
Please know that compiler is just a tool, It cant pass instruction on its own!!! operating system only does those things
26th May 2017, 3:07 PM
U L Knw Me soon😉😋
U L Knw Me soon😉😋 - avatar
+ 3
the compiler or interpreter.
26th May 2017, 8:25 AM
Dragon Slayer Xavier
Dragon Slayer Xavier - avatar
+ 2
compiler
26th May 2017, 8:12 AM
Vishnu ks
Vishnu ks - avatar
+ 2
The operating system itself calls the main function after initializing of non local objects and it is the entry point to the program
26th May 2017, 9:31 AM
Adnan
+ 2
@ aklex then can you explain how the program runs in cmd / terminal?
26th May 2017, 3:03 PM
U L Knw Me soon😉😋
U L Knw Me soon😉😋 - avatar
+ 1
COMPILER
26th May 2017, 9:01 AM
ARAVIND BALAJI
ARAVIND BALAJI - avatar
+ 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
26th May 2017, 9:46 AM
U L Knw Me soon😉😋
U L Knw Me soon😉😋 - avatar
- 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
26th May 2017, 1:42 PM
aklex
aklex - avatar