I am learning C++ and I came to know that pointers if left uninitialized could point to random locations in memory and create problems that memory might be used by some othe
It's alway better to initialize a pointer to NULL if for any reason you can't initialize it while declaration occurs . For example:
Object *ptr = new Object();
Typically a function can check the value of the pointer against NULL to verify that the pointer has been initialized before. If you haven't set it explicitly to NULL, and it points to a random value, then it could be dereferenced causing a segfault.