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
int a,*ptr;
now
print(ptr,*ptr)
In the above code two cases can be possible:
It'll execute if default value in ptr is not the address of some used memory of program.
Output:
ptr *ptr
eg. 0x400730 -1992206795
It'll give error (segmental fault) if default address in the ptr is the address of some used memory of program. E.g. if the address of variable a in the memory is also 0x400730.