Can we compile a program without main() function?

Short Answer
Views 1102

Answer:

Yes, we can compile, but it can't be executed.

But, if we use #define, we can compile and run a C program without using the main() function. For example:


#include<stdio.h>    
#define start main    
void start() {    
   printf("Hello");    
}    

Related Articles:

This section is dedicated exclusively to Questions & Answers. For an in-depth exploration of C Programming Language, click the links and dive deeper into this subject.

Join Our telegram group to ask Questions

Click below button to join our groups.