Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors

Void main in C Programming

In C programming, the void main() function is used to define the starting point of a program. However, it is not a recommended practice to use void main() in modern C programming.

Instead, it is recommended to use int main() or int main(int argc, char *argv[]) as the starting point of the program. These functions return an integer value that indicates the exit status of the program. A return value of zero indicates that the program executed successfully, while a non-zero value indicates an error.

Here’s an example of how to use int main():

#include <stdio.h>

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

In this example, the main() function prints “Hello, World!” to the console and returns a value of zero.

Using void main() is considered bad practice because it does not return a value, which can cause issues with some compilers and operating systems. It is recommended to always use a return type of int for the main() function.