Those are both undefined behavior. You are trying to modify memory that you did not allocate. The second is even less safe, because you are assuming a
is going to be allocated to that address every time, which is absolutely not a safe assumption.
3
solved What is the difference between assigning a pointer to variable address and explicitly to memory address?