8

Tired of all these "arrays start at n" posts. So to be a complete fucking hypocrite, I'll elaborate once, and only once. Arrays start at the memory address at which they're allocated, and grow down by the size in bytes of the data type. ESP(stack pointer) is the top of the stack, and each addition moves downward(esp-4, esp-8, usw). So, top of the stack is 0(base pointer at the start of memory allocation). That's it. Case. Fucking. CLOSED.

Comments
  • 1
    Tbh. Since turning off the Joke/Meme category I’ve stopped seeing most of these “array” posts.
  • 1
    Arrays don't grow down, they grow up, which is why you can use pointer++ to walk through them from the starting address.

    In case the stack allocation is done via an array, the stack pointer is initialised to the address one past the array for a fully descendent stack - not with the beginning of the array.
  • 0
    @Fast-Nop oh FFS, you know what I mean.
Add Comment