Why Do We Use Void Main() In C-language & What Its Meaning?


12 Answers

Alongbar Daimary Profile
Main() is the function from which a c program starts its execution
So it important in most of the C program.
And every function returns some value after its execution.
If we don't need any return type we declare a function starting with void.
Means void is a return type.
In place of void main we even can write
int main()
char main()
float main()
as per our requirement.
Anurag Agrawal Profile
Anurag Agrawal answered
Void is a return type which is used before a function for defining that the function is returning no value.

The function main() is the main/head function of the program and used for the execution of our program. So it is no needed that we put a return type before main().. (an int return type is considered, when no return type is written).
So we do put a void return type before main() in our program.
Anonymous Profile
Anonymous answered
You must have read about Functions in C.

Every Function in C returns a value to the Calling Function. You must have already seen this. Whenever you called a function by passing its arguments, it tells the calling function a value in return.

'main()' is also a function, that can be CALLED if you are using multiple files.

For example, if you are programming a game suppose hangman, you may wish to make a separate C file that stores the number of wrong alphabets entered, suppose 'Misses'. If so, later you'll need to call the 'main()' of 'Misses' in your final file.

Since you need an integer value, you'll have declared 'main()' of Misses as 'int main()'. Also, there will be some variable declarations in the brackets.

But if you're simply using only one file, then there's no value to be returned. So 'void main()' is  written.
Murali Krishna Profile
Murali Krishna answered
Hai..actually the program execution starts with main() default it returns a return type of int() type..if we want a specified return type we use int,char,float.....when we  use void means if we don't want any return type..on that purpose only we use void return type
Ambika ambi Profile
Ambika ambi answered
Main is a driver function. Void is a return type of the main function void means not returning any thing.
The program execution starts from the function main this means main is a starting point of your program.
Anonymous Profile
Anonymous answered
We use void main to restrict computer to input any value in the program.It is also a keyword.
Anonymous Profile
Anonymous answered
Void main() is a predefined function in "c"  from where we start a c program...the compiler begins its execution from main().
Alongbar Daimary Profile
In C or C++

Main is a function and it is generally important to write in most of the program for when compiler compiles it looks for it.
And Void is a return type of a function that is meant return nothing. Actually each and every function returns some value that means as per our requirement we even use like below:
Int main()
char main()

Answer Question