#include <iostream>
using namespace std;
int globalVal = 5;
int m1(int *&p)
{
p = &globalVal;
}
int m2(int *p)
{
p = &globalVal;
}
int main() {
int *p = NULL;
m2(p);
if(!p)
cout << "NULL 1" << endl;
else
cout << "NOT NULL 1" << endl;
m1(p);
if(!p)
cout << "NULL 2" << endl;
else
cout << "NOT NULL 2" << endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IGdsb2JhbFZhbCA9IDU7CgppbnQgbTEoaW50IComcCkKewoJcCA9ICZnbG9iYWxWYWw7CQp9CgppbnQgbTIoaW50ICpwKQp7CglwID0gJmdsb2JhbFZhbDsJCn0KCgppbnQgbWFpbigpIHsKCglpbnQgKnAgPSBOVUxMOwoJCgltMihwKTsKCQoJaWYoIXApCgkJY291dCA8PCAiTlVMTCAxIiA8PCBlbmRsOwoJZWxzZQoJCWNvdXQgPDwgIk5PVCBOVUxMIDEiIDw8IGVuZGw7CgkKCW0xKHApOwoJCglpZighcCkKCQljb3V0IDw8ICJOVUxMIDIiIDw8IGVuZGw7CgllbHNlCgkJY291dCA8PCAiTk9UIE5VTEwgMiIgPDwgZW5kbDsKCQoKCXJldHVybiAwOwp9