+ 1
Can You Write a C Program Without a Main Function ?
Have you ever wondered how to write a C program without a main function? Can a C program execute without a main function? Is it possible to do that?
3 Answers
+ 3
#include<stdio.h>
#define decode(s,t,u,m,p,e,d)m##s##u##t
#define begin decode(a,n,i,m,a,t,e)
int begin()
{
printf("hai");
return 0;
}
output: hai
+ 2
No. Main function is a must in C Program.
But still you can do some tricks using define to avoid it đ
#include <stdio.h>
#define xyz main
void xyz(){
...
}
But still main is always somewhere. đđ