#include<cstdio>
int main() {
int a[5] = {1,2,3,4,5};
int *ptr = (int*)(&a+1);
printf("%d %d" ,*(a+1),*(ptr-1));
}
here there the address location of a+1 is typecasted to point ptr;
i have tried ptr = (int)&a it is pointing the array.. as pointer address is stored in some location pointer ptr is pointing to that location how it is able to reference the location of array elements using *ptr
the output of the program is 2 5 can you please explain how 5 is the output