in c we need not mention return type
directly we can use main();
but in c++ we have to mention return type
ie void main();
or int main();
etc why is this so??
in c we need not mention return type
directly we can use main();
but in c++ we have to mention return type
ie void main();
or int main();
etc why is this so??
C automatically types as int if no type is provided, if I recall my adventures into C properly. Also void main() is wrong, even if it lets you do it.
We did this already - http://cboard.cprogramming.com/showthread.php?t=93015
If you didn't understand it, then post your concerns on the original thread. Don't just post the same question in the next forum.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.