+ 2
Why i got message "main must return int"?
i've try to run this code: void main(){ //blablabla } and got message "main must return int", Why it's happen?
5 Respuestas
+ 5
Please use the search bar to search for threads which may answer to your query, to avoid posting duplicate threads.
https://www.sololearn.com/Discuss/1225/?ref=app
+ 5
in c
this is a warning
main()
{
}
In c++
this is error
main()
{
}
+ 4
With C++ and C, the main function must be declared as an int, and therefore must return an int. In your code, you had changed the main function to a void, returning an error. Try changing void main() to int main() and add a line at the end of your function that returns 0.
int main(){
statement(s)
return 0;
}
+ 1
main requiring a return type of int couldn't possibly be the answer could it?
+ 1
It's necessary for main() function to return an integral value (0) to operating system because it checks the number to verify that the program has run successfully or not . If it returns a value 0 it has ran successfully or any other value means it contains a problem
int main()
{
//
}