pointer behaviors in c++

This dereferences an uninitialized pointer, resulting in UB:

*p = i;

You probably want this instead:

p = &i;

Browse More Popular Posts

Leave a Comment