Learn about C Program Without Main() Function using preprocessor in the below code example. Also refer the comments in the code snippet to get a detailed view about what’s actually happening.
We used the pre-processor directive #define with parameters in this program to provide the impression that the program runs without using main. A pre-processor is a program that processes source code before it is compiled.
C Program Without Main() Function using preprocessor
#include<stdio.h>
#define fun main
int fun()
{
printf("Hello, World.\n");
return 0;
}
Output:
Hello, World.
Hope above code works for you and Refer the below Related Codes to gain more insights. Happy coding and come back again.
Similar Codes :
C Program to Find Largest Number – Dynamic Memory Allocation
Sum of N elements in C using Pointer Using calloc() and free()