Google Add

Search

Write a C program to run without main() function






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". 



No comments:

Post a Comment