+ 9

What is the difference between int main () and void main()?

27th Oct 2016, 2:18 PM
Gaurav Pandey
Gaurav Pandey - avatar
6 Antworten
+ 8
thanks
28th Oct 2016, 3:14 AM
Gaurav Pandey
Gaurav Pandey - avatar
+ 3
If you will enter int main() then to end the program you also have to return 0() but there is no need to write return 0() if you start with void main()
27th Oct 2016, 3:15 PM
Gulshan
+ 2
don't use too much void main(). int main() always better
27th Oct 2016, 6:54 PM
Pamir Ünsal
Pamir Ünsal - avatar
+ 1
Every function must have a return type, as per the rule. Return type means the type of value that will be returned by the function. If we don't require any value to be returned by the function, we must use 'void' as the return type of function. void means "nothing or no-value". Using int as return type for our function requires a return statement at the end of the program which should return an integer value. In most compilers, for int return type, the default value 0 is automatically returned.
27th Oct 2016, 6:54 PM
Shad Ahmad Zaidi
Shad Ahmad Zaidi - avatar
+ 1
int main() returns integer value where void main() returns non value...means if u use void(returnless)...then u ll nothing have to return.
17th Nov 2016, 4:16 AM
Arun Vishwakarma
Arun Vishwakarma - avatar
+ 1
👍👍keep coading brother
17th Nov 2016, 4:18 AM
Arun Vishwakarma
Arun Vishwakarma - avatar