A function that returns something does not have a return statement. Is it valid ?
#include <iostream>
using namespace std ;
int function1()
{
}
int main()
{
int x1 = function1() ;
cout << x1 << endl ;
//return(0) ;
}
Output:
4196237
It compiles and even runs without any errors but according to the standard it is "undefined behavior" . Why does C++ compiler allow it at all ?