c - C 中的数组下标

标签 c arrays linux gcc

<分区>

我一直在寻找允许声明类似内容的相关 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]; };
    }

关于c - C 中的数组下标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28885292/

相关文章:

arrays - Cakephp 在查找操作中使用数组变量

node.js - 使用 smbget 在 Node js 中从 Windows 转移到 Linux

c - 关于 C 中的返回类型

c - 每秒发送数据数小于params,如何每秒发送更多数据?

在使用 getchar() 的普通程序中未检测到 CTRL+D (EOF)?

arrays - 如何计算数组数组的 `false` 个元素

Android 列表 - 隐藏支持数组中的项目

linux - arm hello world 未启动 - 命令对齐而不是页面对齐

php - 将十六进制数据从 PHP 传递到外部程序

c - 在MKL中调用cblas_sgemm时如何避免fork-join?