Shouldn't it print 1 ?
arr[idx] is syntax sugar for *(arr + idx) so -1[p] == p[-1], and since p starts at the second element you should have the first then.

But does it compiles everywhere ?
Years ago, I had a similar situation with compiler warning about arithmetic operation on pointers, like "trying to access the *p value of the -1 array", but I don't remember well so I'll say 1, .x value of the 0th element 馃檪


@Xipiryon hint 1: it does not index by -1, due to operation precedence.

Guess 2 


Then -7 ? Since p already points to arr[1], then it's -((p+1)->x), so the 3rd element of the array 馃檪

At least I hope operator precedence doesn't imply (-(p+1))->x, because it lools like an undefined behaviour then 馃槄

Oh and btw it's super nice of you to take the time to answer everyone !

Guess 2 

@Xipiryon third element of the array, bingo! but that's not 7 or -7 :P

Eman izena elkarrizketan parte hartzeko

mastodon.eus euskararen eta euskal kulturaren komunitatearentzat sortutako Mastodon sare sozialeko euskarazko instantzia bat da.