Code:-
#include<iostream>
int main() {
int arr[] = { 10,20,30,40,50 };
int* i, * j;
i = &arr[1];
std::cout << i<<std::endl;
j = &arr[3];
std::cout << j<<std::endl;
std::cout << j - i << std::endl << *j - *i;
}
Output:-
000000D20EDEF96C
000000D20EDEF974
2
20
On the execution of j - i printf should have printed 8 but instead it prints 2.
Can you explain what's the mystery behind this?