Index vs. Pointer
<p>I'm using arrays of elements, many of which referencing each other, and I assumed in that case it's more efficient to use pointers.
But in some cases I need to know the index of an element I have the pointer to. For example I have <code>p = &amp;a[i]</code> and I need to know the value of <code>i</code>. As I understand it, <code>i</code> can be computed through <code>p - a</code>. But this operation inherently involves division, which is expensive, whereas computing an address from an array index involves a multiplication and is faster.</p>

<p>So my question is, is cross referencing with pointers in a case where you need the indexes as well even worth it?</p>