C function defined as int but having no return statement in the body still compiles

The return value in this case, depending on the exact platform, will likely be whatever random value happened to be left in the return register (e.g. EAX on x86) at the assembly level. Not explicitly returning a value is allowed, but gives an undefined value.

In this case, the 14 is the return value from printf.

Leave a Comment