Difference Main functions and user defined functions? |
[Improve]
main function in C programming language and almost in every other main language is the main function that launched after the program starts. It takes two arguments, pointer to pointers array (arguments) and number of arguments.
If you would write your own functions and link by telling the entry point to your program you would not be able to get arguments any more. There are some code running before actually main function is launched. That code prepares the argument data for main function.
But it is possible to change main function to your defined function, but that would require more knowledge of how linker (ld) and for example objcopy utility works.
Note: There might be a difference in GNU and Microsoft C/C++ versions.
If you would write your own functions and link by telling the entry point to your program you would not be able to get arguments any more. There are some code running before actually main function is launched. That code prepares the argument data for main function.
But it is possible to change main function to your defined function, but that would require more knowledge of how linker (ld) and for example objcopy utility works.
Note: There might be a difference in GNU and Microsoft C/C++ versions.
First answer by David.lt. Last edit by David.lt. Contributor trust: 15 [recommend contributor]. Question popularity: 2 [recommend question].



