This question is out of curiosity; while writing a main for a test program, I returned nothing from main
(no return
statement in main
). But I declared main as int main()
. And it compiled successfully.
Where as if there is any other function written with a int
return type and actually not returning an int
,I would get an error
'Function name' must return value
So why compiler doesn't complain the same for main
function?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…