Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Array subscript variable?
Array subscript variable?
The landlord may have misunderstood.

In essence, the definition is this.

Before using an array, be sure to define its subscripts. At this time, a known quantity is needed.

N is a specific known quantity after your question is scanned.

So a[n] is ok.

In C language, if you don't set the subscript size, you can't use arrays. Just give the subscript size before use.

If this variable is known, it is equivalent to a constant.

We often use the macro #define N5, which is exactly the same.

Then the compiler environment definition is different. Now the new version should support everything.

I can do it with dev-C.

I mentioned this when I was reading a book. TC is too old to support it too often.

And the landlord. . . Macro. Broadly speaking, it means that # defines a variable constant.

Of course, the variables here are not allowed to change. So we call it a character constant. It is also called a subscript, not a variable. Because this value is not allowed to change.

I just want to give you an analogy. I'm telling you, just like this question. When your n comes in. The value is also certain! ! ! ! ! It is also a fixed value, so it can be used as a macro for the time being.

So dev-c is right. I guess this is your version. Or environmental differences. It depends on the compiler. . I hope you don't spit at random.