Pointer Reference to changing values?
Today through trial and error and playing with pointers, that if you have a pointer to a variable whose value is getting changed the memory address moves? The line I tested with is int userCounter = 0; int *pUserCounter = &userCounter; *pUserCounter++; Upon cout I noticed that the initial value is zero, yes great. But then the next value was a different memory address and then the next was 0 again. I know realized that having a pointer to an object does not give it the full effect to edit the object? I know the difference between pass by reference and pass by value and how to make a reference, which is using the & operator as well. But why did that particular output happen? I thought I was changing the value at that memory address so why did it display a different address?