Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - In C, why can’t arrays be defined first and then assigned?
In C, why can’t arrays be defined first and then assigned?

First: Because the system allocates the memory address to the array at ~ (it seems to be during compilation) and

At this time, the system has not allocated memory to the variable, that is, this At this time, the integer variable a does not exist. You cannot use

a non-existent number to define the length of an array.

Second: Your question uses the integer 10 to define the length of the array, rather than using variables, so it is valid.

Third: The problem with this question is that the array name and variable name you wrote are the same.

This way of definition seems wrong

It seems wrong