Let's say we have an array of 16 bytes, and some 4 byte integer. Before calling a function, we push the array onto the stack; then we push the integer.
Now, it is my understanding that "below" the base pointer is the return address and the parameters; right above, and "below" our stack pointer at the top, are local variables we've pushed onto the stack (and registers).
How would one figure out where the starting address of the array is, as well as the integer? Would it be accurate to simply do "ebp - 16" for the array, -20 for the integer, or is there a detail I'm missing? Could we also reference these things relative to esp, or is that unconventional?
Additionally, are there implementations that might handle this addressing differently?
And lastly, is it necessary to pop these things from the stack before our function ends?