• Parth

main() function in C


main is an identifier in the program which indicates startup point of an application

main is a user defined function with predefined signature for linker 

A linker is assembly language program which always decides startup point of the program is main

It is possible to develop a program without using main function also in this case compilation is success but linking is failure.

Generally main() function doesn’t returns any value that’s why return type of main function is void.



int main() function provides exit status back to the OS. i.e success or failure i.e return 0 means return EXIT_SUCCESS & return 1 means return EXIT_FAILURE