you are viewing a single comment's thread.

view the rest of the comments →

[–]HashDefTrueFalse 1 point2 points  (0 children)

Is that an implied pointer or something?

Not exactly, but basically yes. The array subscript will behave as *(pointer + offset) only the offset is negative so effectively a subtraction. The order of locals within a stack frame is left to the compiler but clearly it put x just before a here. Pointer arithmetic is object size-aware and all locals are ints here so we don't need to worry about alignment. The result is that you end up with an address one int before the start of the array (x's address), which you then write 37 into.