- In C ++ function must have a return type, and C defaults to int.
- C ++ and return the actual return type must be the same type of return, or an implicit conversion may be performed, C and no such limitation can be arbitrarily return.
- Can not have a C ++ function is called without parameter arguments, C can be used in any type, any number of parameters invoked.
f(void) {char a = 0; double d = 0; if(a == 'a') { return &a; } else { return d; } } int main () { int i = 0; double d = 0; double *pd = &d; f(i, pd); return 0; }
Compiling pure C implementations, a warning will be given, but by default the compiler (many compilers except as provided by the warning as errors). But given C ++ compiler error. vs2015 with compiler error message is given as follows: