In C + +, the definition of a function is:
Type name (P1,P2)
{stament};
Where type is the return value of the function, name is the identifier of the function, and P1,P2 is the two parameter of the function, which is scoped only within the function body.
When a function does not return any value, the function is an empty function, its type is void, and when the function does not have parameters, it can also use void to indicate no arguments, or to fill in nothing, for example:
void printmessage (void)
{
cout << "I‘m a function!";
}
An empty function is defined that has no return value and has no parameters.
For the main () function, the return value of the function is int, and the return value defaults to the return value of the 0,main () function, return 0; is not meaningful, the return value of 0 only indicates that the function is functioning properly.
return value types and parameter types for C + + functions