Cover Image for C program without main
88 views

C program without main

The main function is the entry point of a program, and it is required for the program to execute. A C program cannot run without a main function. The main function is where program execution begins, and it typically contains the code that performs the program’s tasks.

Attempting to create a C program without a main function will result in a compilation error, and the program will not run.

Here’s a simple example of a C program with a main function:

C
#include <stdio.h>

int main() {
    printf("Hello, World!\n");
    return 0;
}

This is a standard C program that prints “Hello, World!” to the console when executed. The main function is where the program starts execution, and it contains the code for this simple task.

YOU MAY ALSO LIKE...

The Tech Thunder

The Tech Thunder

The Tech Thunder


COMMENTS