Int test(){
char buff[10]
printf("Enter text: ");
gets(buff);
puts(buff);
}
I don't know how to phrase this question but I'm trying to understand how values are stored on on the buffer allocated for local variables on the stack frame.
---------------
Return Address
---------------
old ebp
---------------
local variables
---------------
Is each block 4 bytes and divided in to 4 1 bytes?
------------------
00 | 40 | 06 | 06
------------------
ff | ff | de | 70
------------------
Through gdb I saw the buffer allocated for test was 0x10
I entered sssssssss
:
x/x $rbp = 0xffffde70
x/x $rbp + 8 = 0x00400606
x/s $rbp - 16 = "sssssssss"
x/s $rbp - 8 = "\ns"
x/s $rbp - 4 = ""
So how are the characters(in hex) that I entered stored? like how many on each block. It's a 64 system.
-----------------
00 | 40 | 06 | 06
------------------
ff | ff | de | 70
------------------
| | |
------------------
| | | s
------------------
s | s | s | s
------------------
s | s | s | s
------------------