Write a C program to run without main() function

Leave a Comment





How to make a program in C and C++ without any main() function



 Here is an example of C and C++ program which run without main() function .




#include<stdio.h>
#define  main  my // macro declaration


void  my()
{
    printf("Hello C Language");
}




The above code runs because we defined main as my and at the time of compilation "my" is interchanged to "main". 



If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment