开发者

c syntax: array [duplicate]

开发者 https://www.devze.com 2023-01-19 13:22 出处:网络
This question already has an answer here: Closed 12 years ago. For char[size], is it true that size must be开发者_运维知识库 constant?
This question already has an answer here: Closed 12 years ago.

For char[size], is it true that size must be开发者_运维知识库 constant?

Or say,will it work ?

int length;
...

char[length] arr;

Sorry,don't have the environment here so can't try it myself.


Pre C99, yes; the size of an array must be a constant integral expression. C99, however, adds Variable Length Arrays (VLA's), which allow an array to have a dynamic size.

0

精彩评论

暂无评论...
验证码 换一张
取 消