+ 1
Can i use void main() in place of int main()?
everytime i use int main() i have to use return 0... but in case of void main() i dont hav to do that
5 Antworten
+ 3
it depends on what compiler you are using if you are using linux based compiler you must use int main or if you are using code blocks or any such ide you should use int
but in turbo c/c++ void will also work.
+ 1
Yes why Not you can use a int main() in place of a void main().
In void main() you cannot return value but in int main() you can return values which are integers.
There is no problem is you use int main() instead of void main().
0
why?
0
wat error?
0
I just want to point out that even though main must be int, you can leave out the "return 0;". You usually can't do that but for the main function they made an exception.