Can you execute a program without the main function? code example
Example 1: run program without main method using macro
#include<stdio.h>
#define start main
void start()
{
printf("Hello, World!!!");
}
Example 2: Can we execute a program without main() method
Yes, one of the ways to execute the program without the main method is
using static block
What if the static modifier is removed from the signature of the main method??
Program compiles. However, at runtime, It throws an error "NoSuchMethodError