Why can't we use the void main() function in the hello world program?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why can't we use the void main() function in the hello world program??

20th Oct 2018, 11:10 AM
Ramya Devi Nataraj
Ramya Devi Nataraj - avatar
8 Answers
+ 5
Void return type for main() is not standard. While some compilers may support it, you should not practice it. http://www.stroustrup.com/bs_faq2.html#void-main
20th Oct 2018, 11:31 AM
Hatsy Rei
Hatsy Rei - avatar
+ 1
because the main method is already exist. Try other method name.
20th Oct 2018, 11:20 AM
Faze amuzante frumoase şi distractive E24
Faze amuzante frumoase şi distractive E24 - avatar
+ 1
aaa... not java... ok
20th Oct 2018, 11:21 AM
Faze amuzante frumoase şi distractive E24
Faze amuzante frumoase şi distractive E24 - avatar
0
but in many c++ programs then y do we use void main ()??it already exists ri8?thn y do we use tat
20th Oct 2018, 11:22 AM
Ramya Devi Nataraj
Ramya Devi Nataraj - avatar
0
I dont know very much c++ almost nothing to this i know Java the best
20th Oct 2018, 11:23 AM
Faze amuzante frumoase şi distractive E24
Faze amuzante frumoase şi distractive E24 - avatar
0
okay.. anyway thank you..
20th Oct 2018, 11:24 AM
Ramya Devi Nataraj
Ramya Devi Nataraj - avatar
0
you're welcome
20th Oct 2018, 11:25 AM
Faze amuzante frumoase şi distractive E24
Faze amuzante frumoase şi distractive E24 - avatar
0
okay.. thank you!!
20th Oct 2018, 11:33 AM
Ramya Devi Nataraj
Ramya Devi Nataraj - avatar