How do I reset my pointer to a specific array location?
You can do exactly as you did first when you assigned p
:
p = &values[0];
Besides, arrays are very much like pointers (that you can't change) to statically allocated memory. Therefore, the expression &values[0]
evaluates to the same thing that just values
does. Consequently,
p = &values[0];
is the same as
p = values;