C 中的数组下标

Array subscript in C

我一直在寻找允许声明类似内容的相关 GCC 文档。

unsigned int subs = 10;
unsigned int array1[subs];

我知道这样的声明是有效的并且可以使用 gcc。我想获得指定可以声明的相关 GCC 文档。

谢谢,

来自6.9 Arrays of Variable Length

As an extension, GCC accepts variable-length arrays as a member of a structure or a union. For example:

    void
    foo (int n)
    {
      struct S { int x[n]; };
    }

如前所述here

Another GNU extension allows you to declare an array size using variables, rather than only constants.