This dereferences an uninitialized pointer, resulting in UB:
*p = i;
You probably want this instead:
p = &i;
More Related Contents:
- Dangling Pointers after Destructor is called
- What is array to pointer decay?
- Pointer to class data member “::*”
- What is a dangling pointer?
- Placement of the asterisk in pointer declarations
- Differences between unique_ptr and shared_ptr [duplicate]
- How do you pass a member function pointer?
- Is passing pointer argument, pass by value in C++?
- How to compare pointers?
- How are references implemented internally?
- conversion of 2D array to pointer-to-pointer
- C/C++ int[] vs int* (pointers vs. array notation). What is the difference?
- Why are NULL pointers defined differently in C and C++?
- Function pointer vs Function reference
- What happens to the pointer itself after delete? [duplicate]
- Is it legal to compare dangling pointers?
- Why not use pointers for everything in C++?
- Can I Allocate a specific memory address using pointers in c++?
- Difference between const. pointer and reference?
- Is it legal/well-defined C++ to call a non-static method that doesn’t access members through a null pointer?
- In C/C++, is char* arrayName[][] a pointer to a pointer to a pointer OR a pointer to a pointer?
- Why do linked lists use pointers instead of storing nodes inside of nodes
- how do arrays work internally in c/c++
- Understanding -Weffc++
- Why is a c++ reference considered safer than a pointer?
- Safety of casting between pointers of two identical classes?
- How can a char pointer be initialized with a string (Array of characters) but an int pointer not with an array of integer? [duplicate]
- Does ‘auto’ type assignments of a pointer in c++11 require ‘*’?
- Is it possible to have a pointer literal?
- Pass by pointer & Pass by reference [duplicate]