# What type of function is main()?

As the functions are of 2 type:
1.Pre-defined/library functions,
2.User defined functions.

What type of function is main() function?

This doubt comes in my mind while writing a program we define the main() function as we do the others.

• Emm user-defined?.. C++ program should have main function when linker links it to the binary code which starts executing the program calling this function. It was not the only way long time ago, not sure how it works nowadays. – Eugene Mar 11 '17 at 7:15
• How is this a computer science question? – Raphael Mar 11 '17 at 10:13
• @Raphael, then tell me to which subject does this question belongs? – Harsh Kumar Mar 13 '17 at 5:14
• Depends. Where have you found this (very rough) classification? To me, this reads like a programming question. – Raphael Mar 13 '17 at 7:36
• Ohhh! I beg your pardon. For giving the tag as functional-programming – Harsh Kumar Mar 13 '17 at 13:40

User-defined functions are functions that the user defines. This is the case of the C/C++ main().
You can think of main() as a placeholder or hook. The user supplies it, but the standard library knows to call it after initializing itself.