Why don't we declare main function prior to it's calling in c++ ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Why don't we declare main function prior to it's calling in c++ ?

If we need to declare every function before it's use then why not main function in c++? Why is it so special

26th Jul 2017, 5:06 AM
Milkha_Da_Techie
Milkha_Da_Techie - avatar
1 Answer
+ 12
The declaration of main() is fixed inside the compiler. As for why it is so 'special', it plays a huge role in program execution - it has to exist and hence is pre-declared for programmers to define main() contents. https://www.hackerearth.com/practice/notes/is-main-function-a-built-in-function-or-user-defined-function/
26th Jul 2017, 5:20 AM
Hatsy Rei
Hatsy Rei - avatar