Assume unsigned short is 1 byte and unsigned int is 2 bytes. Please consider following code Snippet:
void program(unsigned short *dst, unsigned short const *src, size_t num)
{
unsigned short status=1;
/* Now program cell-wise (i.e 8 bytes in one stretch) */
while ((num > 0) && (status))
{
status = m32_program_8byte((unsigne
d int *)dst, (unsigned int *)src);
num -= 8;
dst += 8;
src += 8;
}
}
Pointers dst and src were pointing to unsigned short but this is modified so these pointers are pointing to unsigned int. When pointer math is performed at the end of the function, will dst and src increase by 8 bytes or 16 bytes.
thanks.
Start Free Trial