Speed of a pointer that traverses

This a question about pointers.

If I move a point to a new address,

int * ptr = new int[100];

Does it take longer to travel through more bits.

I.E.

ptr + 1

Takes less time to calculate than

ptr + 50?


Another way of asking it is pointer addition a O(1) time complexity operation?
Last edited on
The pointer does not take on every value sequentially until it reaches the one you want.

1
2
int x = 1;
x = 50;


x doesn't take every value from 2 to 49 before stopping at 50. It's the same with pointers. The pointer does not traverse. It had one value. Then it has a different value.
Last edited on
Perfect. Thank you!
Topic archived. No new replies allowed.