It is not recommended to use a pointer to main() or the address of main() , but ..
In any case, this is allowed, since each function (and any character, for example, a variable) has its own address. And the main () address may be required, especially when you write code for embedded systems and play with dynamic code loading or runtime checking. Or there is a bootloader and actual firmware.
Often, main() is the entry point to dynamically loaded code (for example, from FLASH to RAM) and, thus, it is referenced (called directly or assigned to the corresponding pointer) in the loader.
Refer to MicroC-OS / II or VxWorks - use main() this way
Robert Mutke
source share