3 ms·
Pointer arithmetic is not needed any more only when the programming language provides high-level operations with arrays, like APL, J, K and similar languages.
by adrian_b 5y ago
Pointer arithmetic is not needed any more only when the programming language provides high-level operations with arrays, like APL, J, K and similar languages.
A very good optimizing compiler could generate a code for accessing the arrays that would use either indices or pointers, depending on the target CPU and on the desired operation.
Otherwise, if you have to write explicit loops and the compiler is not extremely clever, for optimal performance you might need to use pointers instead of indices in many cases. The optimal choice can differ between target CPUs, e.g. for Intel/AMD CPUs indices are often better than pointers, while for ARM or POWER CPUs pointers are more frequently better.