int * ref () {
int tmp = 100;return &tmp;}
int main () {
int * a = ref();//Up until this point there is defined results//You can even print the address returned// but yes probably a bug
cout << *a << endl;//Undefined results}
int * foo(){int *x = new int;*x = 5;return x;}
int main(){int* p = foo();std::cout << *p << "\n"; //better to put a new-line in the output, IMO*p = 8;std::cout << *p;delete p;return 0;}