CodePudding user response:
Int main () {.
return 0;
}
This is one of the main function structure of c/c + + standard, remove the return 0; Results are different on different compilers, sometimes can sometimes keep
Get into the habit of in accordance with the standards, to ensure that in every compile environment is available
CodePudding user response:
Relatively new c + + standard should be supported, but for the sake of compatibility, it is not necessary to omit itCodePudding user response:
The main function is not must be defined as an int, if to remove can not run from the intCodePudding user response:
Ok, three grams of oil, a great godCodePudding user response:
Can support, but it's better to addCodePudding user response:
Why to remove return0? Defined as return int, this also is very useful, general function, use int to do return value, in function, you can use 1 s and 0 s, this is one of the types of fault tolerant measures, such as your files in the directory, you will make a judgment, if there is no file directory, and return 1 to give to the top, the upper according to this state, you again returned to the corresponding response, if you don't return 1, the function of that file, then continue to perform the function of other functions, you as a state value, the return is very usefulCodePudding user response:
Defines the function return value does not return values, under the VC: detect at least one return value, complains, detected, but not all path return value, be warned, it seems,Not an error in the g + +, but may collapse,
For example,
Int fun ()
{
}
Int a=fun ();
May be an error,