A C Program without main()

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

#include<stdio.h>
#define begin m##a##i##n
 
void begin() {
   printf("Hello");
}

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()).”
http://www.quora.com/Is-main-a-keyword-in-C-and-Java

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