C | Advanced Pointer | Question 3

Last Updated :
Discuss
Comments
C
#include <stdio.h>
int main()
{
    int a[5] = {1,2,3,4,5};
    int *ptr = (int*)(&a+1);
    printf("%d %d", *(a+1), *(ptr-1));
    return 0;
}
2 5
Garbage Value
Compiler Error
Segmentation Fault
Tags:
Share your thoughts in the comments