Variable length arrays (VLA) in C and C++

后端 未结 5 2100
旧巷少年郎
旧巷少年郎 2020-11-30 06:07

Possible Duplicate:
Variably modified array at file scope

I have some concepts about the VLA and its behavior

5条回答
  •  情歌与酒
    2020-11-30 06:55

    C++ doesn't support VLAs, period. The reason the second code snippet works in C++ is that the const keyword creates a compile-time constant in C++; in C, it doesn't.

    C99 doesn't support VLAs outside of block scope, period, regardless of how you declare the size variable. Note that C2011 makes VLA support optional.

提交回复
热议问题