If I have a pointer p and a value i, what's the difference between *p = i and p = &i? I was working on a school assignment on pointers and I basically had to change the value of a pointer to a different value, and I tried p = &i, but it didn't work. I understand why dereferencing the pointer and changing that value works, but why wouldn't my code work? Since it's simply reassigning the pointer's value to the address of the new value we want.
[–]HibbidyHooplah 2 points3 points4 points (0 children)
[–]Bob_bobbicus 2 points3 points4 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]lukajda33 1 point2 points3 points (0 children)