我正在尝试使用指定的初始化程序初始化结构数组:
A[size].from = {[0 ... size - 1] = 0};
A[size].to = {[0 ... size - 1] = 0};
列表.h:
typedef struct Buffer
{
int from;
int to;
}buffer_t;
typedef struct shared_memory
{
buffer_t A;
int size;
} share_t
主程序
#include <stdio.h>
#include "list.h"
buffer_t A[];
int size;
void main(int argc, char *argv[])
{
share->share_t *share = (share_t *)malloc(sizeof(share_t));
long arg = strtol(argv[1], NULL, 10);
size = arg;
share->A[size] = {[0 ... size-1] = 0};
}
但是,这是我收到的以下错误:
我正在使用 MinGW gcc 和命令提示符来编译这段代码,我正在 Visual Studio 中编写这段代码。