I'm trying to initialize an struct array using designated initializer:
A[size].from = {[0 ... size - 1] = 0};A[size].to = {[0 ... size - 1] = 0};
List.h:
typedef struct Buffer{ int from; int to;}buffer_t;typedef struct shared_memory{buffer_t A;int size;} share_t
Main.c
#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};}
However this is the following error I'm receiving:
I'm using MinGW gcc and command prompt to compile this code and I'm writing this code in Visual studio.