#The type of return value of a C language function is determined by the function type specified when defining the function.
The type of function value should be specified when defining the function. When defining a function, the type specified for the function value should generally be consistent with the expression type in the return statement. If not, the function type shall prevail, that is, the function type determines the type of the return value.
Example:
int fun(int a) { float a=1.5; return a;//warning C4244: 'return' : conversion from 'float ' to 'int ', possible loss of data }
At this time, 1 is actually returned instead of 1.5.
Recommended: "c Language Tutorial"
The above is the detailed content of What determines the return value type of a C language function?. For more information, please follow other related articles on the PHP Chinese website!