How much stack space is allocated for char buffer[500] only
17:00 23 Jan 2026

I'm disassembling a very simple program written in C and would like to determine how much stack storage is allocated for the char buffer[500] variable. Here is the C program:

int main(int argc, char** argv)
{
    int age = 100;
    char buffer[500];

    strcpy(buffer, argv[1]);
    printf("strcpy gives %s and age gives %d\n", buffer, age);
 
    return 0;
}

The program was compiled as 64 bit in Visual Studio 2019 with optimizations enabled and I believe the default stack alignment is 16 bytes. Having said that here is the disassembly in Ida Free:

main    proc near

var_208 = byte ptr -208h

sub     rsp, 228h
mov     rcx, [rdx+8]
lea     rdx, [rsp+228h+var_208]
sub     rdx, rcx

loc_14000106F:                          ; CODE XREF: main+1D↓j

mov     al, [rcx]
mov     [rdx+rcx], al
inc     rcx
test    al, al
jnz     short loc_14000106F
mov     r8d, 64h ; 'd'
lea     rdx, [rsp+228h+var_208]
lea     rcx, Format     ; "strcpy gives %s and age gives %d\n"
call    sub_140001008
xor     eax, eax
add     rsp, 228h
retn

endp
c stack ida