int one_d[] = {1,2,3};
int main()
{
int *ptr;
ptr = one_d;
ptr += 3;
printf("%d",*ptr);
return 0;
}
The output is 2. But why? I expect that ptr
has pointed the one_d[3]
since the last assignment ptr += 3
. But one_d
has 3 elements. Can someone explain it to me pls? Thank you so much.