+ 5
What's the difference between void main() and int main()?
8 ответов
+ 4
anything before main will determine the return value upon sucessful completion of the program. int main will return an integer, void main will not return anything.
+ 2
for C: I once heard from someone that int main was the original way of creating a program, but when time advanced, void main came in. don't k ow the specificks and correct me if i'm wrong ;)
+ 1
void main() function is not expected to return any value, while int main() is to return an integer value.
+ 1
return data type, get the basics again . we usually use void as it accepts all return data type but int for integer return type . eg:
int main()
{
return 1;
}
+ 1
I think that void main is non-standard. Basically, main should return 0 if the program finished all work correctly and some other number (called error code) if it failed.
0
void mean function main will not return any value after execution .
but in int main return any int value compulsory otherwise error raise .
void main ()
{
printf("hello");
}
__________________________________
int main()
{
return 0;
}
0
void main return null value whereas int main return integer value
0
C++ program can't return void value from 'main', can it?
'void main' was in old C lang, afaik