We can write c program without using main() function. To do so, we need to use #define preprocessor directive.
The C preprocessor is a micro processor that is used by compiler to transform your code before compilation. It is called micro preprocessor because it allows us to add macros.
A macro is a segment of code which is replaced by the value of macro. Macro is defined by #define directive.
For example:
#define PI 3.14
Here, PI is the macro name which will be replaced by the value 3.14.
Let's see a simple program to print "Hello, World!!!" without main() function.
#include<stdio.h>
#define start main
void start()
{
printf("Hello, World!!!");
}
Output:
Hello, World!!!