Avoiding the main (entry point) in a C program

Viewed 9904

Is it possible to avoid the entry point (main) in a C program. In the below code, is it possible to invoke the func() call without calling via main() in the below program ? If Yes, how to do it and when would it be required and why is such a provision given ?

int func(void)
{
     printf("This is func \n");
     return 0;
}

int main(void)
{
     printf("This is main \n");
     return 0;
}
7 Answers

Rename main to be func and func to be main and call func from name.

If you have access to the source, you can do this and it's easy.

Related