Can we compile a program without main() function?

C Programming Language >   Overview of C Language >   Basic Structure of C Programming  

Short Question

1190


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");    
}    


This Particular section is dedicated to Question & Answer only. If you want learn more about C Programming Language. Then you can visit below links to get more depth on this subject.




Join Our telegram group to ask Questions

Click below button to join our groups.