June 2025
Intermediate to advanced
1093 pages
33h 24m
English
In general, you define a function as follows:
ReturnType FunctionName ( ParameterType ParameterName , ... ) { FunctionBody }
Or you can use the newer syntax, where the return type is at the end or can be omitted altogether. I will go into this more detail in Section 7.11. Sometimes it can be clearer:
auto FunctionName ( ParameterType -name , ... ) [ -> ReturnType ]{ FunctionBody }
You have already heard some of this in passing, but I would like to say something about all these elements once again:
Return typeThe return type is the type of a value that you return from the function with return. All expressions in the return statements must be of this type or convertible to this type. If the return type is void, you ...
Read now
Unlock full access