They must be the same. But:
for( i = 0; i < ...; ++ i ) ... array[i] ...
may be slower than:
for( p = array; *p; ++ p ) ... *p ...
because in the first case, the compiler may be needed *(array+i), and in the second you are simple (*p).
In trivial cases, however, the compiler must be able to optimize and generate the same machine code.
peoro source
share