Hi all, i am new in c++. Need your help on the pointer topic.
I want to set my pointer to NULL through function and make sure my main also retains the NULL value. However whenever i print the ptr address in the main it give me a hex value which i assume is the memory location of pointer pointing to. Anyone can point out my errors ? Thanks alot
You are setting 'ptr' parameter to NULL, not 'ptr' in main.
To modify the position pointed by that 'ptr', you should has as argument type a pointer to pointer or a reference of pointer