main( ) function in c++

If we do not wish to return a value with the main function
the main function is declared as void in C++ because it returns an integer value .But in C it is not done so why?
b__arunaAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
jhanceConnect With a Mentor Commented:
void main()  and int main() are both valid in either C++ or ANSI C.  This just specifies to the compiler what to return back from the program to the operating system.  On most systems, either void or int are possible.  Other return values are likely to be unsupported.  For instance,

char *main()

doesn't work on any system I'm familiar with, but is theoretically possible.
0
 
b__arunaAuthor Commented:
Edited text of question.
0
All Courses

From novice to tech pro — start learning today.