A C Program without main()

I have come across a C program without main(), like the below code

#define begin m##a##i##n
void begin() {

However, here internally begin is converted into main. My question is - If it is possible to write a c Program without main (Internal or External). If possible how?

What this asks is different from what many others have asked and accepted on many C/C++ forums. Googling “is main a keyword in C” gave me this from Quora:
“…main() is not the actual entry point. The actual entry point will be a function defined by the compiler (such as _tmain() in Visual C++ and start() in GCC), which will perform some initialization before calling the programmer’s entry point (i.e. main()).”

I think this would require us to make changes in the compiler if we wish to ever compile a C code sans the function “main()”.

1 Like