[ad_1]
This dereferences an uninitialized pointer, resulting in UB:
*p = i;
You probably want this instead:
p = &i;
[ad_2]
solved pointer behaviors in c++
[ad_1]
This dereferences an uninitialized pointer, resulting in UB:
*p = i;
You probably want this instead:
p = &i;
[ad_2]
solved pointer behaviors in c++