As per Jabberwocky's comment to the question, what you are referring to is a feature of C called variable-length arrays. To quote this cppreference.com's page:
If expression is not an integer constant expression, the declarator is for an array of variable size.
Each time the flow of control passes over the declaration, expression is evaluated (and it must always evaluate to a value greater than zero), and the array is allocated (correspondingly, lifetime of a VLA ends when the declaration goes out of scope). The size of each VLA instance does not change during its lifetime, but on another pass over the same code, it may be allocated with a different size.
This feature was added to the language in the C99 standard (again, as per Jabberwocky's comment. See also https://en.cppreference.com/w/c/99 , section "New language features").
Speaking more generally, the size of an array may be not constant. To quote this cppreference.com's page again:
There are several variations of array types: arrays of known constant size, variable-length arrays, and arrays of unknown size.
As a side note, Jabberwocky mentioned in comments that VLAs may be allocated on the stack. For more information on this, you may see this question: Is it required that a C Variable Length Array is allocated from the stack?