I recently encountered C code for a function that had the following structure:
int fun1(int x){
return x + 2;
}
int fun2(int x){
fun1(x);
}
int main()
{
printf("%d\n", fun2(5));
return 0;
}
It seems like there's a missing return statement in function f2:
return fun1(x);
However it works as intended, and the call fun2(5) returns 7. Is this type of implicit return is undefined behaviour, or is it defined and it will work across different compilers and C/C++ standards?