November 2020
Intermediate to advanced
832 pages
37h 45m
English

As in the first example, this code assumes size is greater than 0.
Note that this program calculates the address of the end of the array in every iteration of the loop, even though it does not change. A faster version of the code moves this calculation outside the loop:

Comparing the two code sequences side by side illustrates the difference between array indices and pointers (the changes introduced by the pointer version are highlighted):
The version on the left must have the “multiply” and add inside the loop ...
Read now
Unlock full access