All for Joomla All for Webmasters

C Program without main() function

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

Let’s see a simple program to print “hello” without main() function.

  1. #include<stdio.h>
  2. #define start main
  3. void start() {
  4.    printf(“Hello”);
  5. }

Output:

Hello
PinIt
submit to reddit

Leave a Reply

Top