I have an exam revision question on pointer arithmetic and one part where we are subtracting the address of two array variables is not making sense to me.
Well one array actually equals the other. I understand the individual outputs for each array variable and in this case the difference between the two addresses is 16, given an int = 4 bytes on this os.
What I don't understand is why the subtraction gives 4. My logic would be that they are 4 positions apart in the array, but this doesn't make sense to me.
int main(void)
{
int oddNums[5] = {1, 3, 5, 7, 9};
int *ip = oddNums;
printf("&oddNums[4] %d - ip %d= %d\n",&oddNums[4], ip, &oddNums[4] - ip);
/*prints &oddNums[4] 2686740 - ip 2686724= 4*/
return EXIT_SUCCESS;
}