You made at least three mistakes, and I'll point out the first and third: i was not initialised, so the first printing of *p prints garbage; *p = 0 assigns 0 to the object pointed to by p, but at that point p points to a destroyed object. You mean to write p = 0;Quote:
Can you tell me if i made any small errors or if i did it completely wrong?
The second mistake will be pointed out by the compiler.
Okay, there is a fourth mistake: x is not initialised either.