Interviews Questions, Algorithms, Aptitude, C Interview Program, C Theory Question, Aptitude Tricks, Test Series,

Saturday, 1 June 2019

C Program without main() function


We can write c program without using the main() function. 
To do so, we need to use the #define preprocessor directive.

Let's see a simple program to print "hello" without main() function.

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

Output:

Hello

0 comments:

Post a Comment