Is stack memory allocated at run-time or compile time?

advertisements

Is the stack allocated at runtime or compile time?
Example:

void main()
{
    int x;
    scanf("%d", &x);
    int arr[x];
}


Stack is allocated at runtime; layout of each stack frame, however, is decided at compile time, except for variable-size arrays.