C program without main
×


C program without main

30

 The provided C program showcases an unconventional way to define the main() function by using the #define preprocessor directive.

 In this example, the main() function is aliased as continue () due to the macro definition.

// C Program without main()
#include<stdio.h>
#define continue main

void contiune() {
   printf("c program");
}

Output:

c program

 #define continue main: This preprocessor directive replaces all occurrences of continue with main throughout the code.

 As a result, continue effectively acts as the main() function.

 void continue (): This is the function declaration for our custom entry point, which acts as main() due to the macro definition.

 printf("c program");: Inside the continue () function, this printf statement will print "c program" when the program is executed.



Best WordPress Hosting


Share:


Discount Coupons

Get a .COM for just $6.98

Secure Domain for a Mini Price



Leave a Reply


Comments
    Waiting for your comments