What is the cause of flexible array member not at end of struct error?

后端 未结 3 1891
南方客
南方客 2020-12-14 07:04

I am wondering why I keep getting error: flexible array member not at end of struct error when I call malloc. I have a struct with a variable length array, and

3条回答
  •  甜味超标
    2020-12-14 07:46

    typedef struct {
      size_t N;
      double data[];
      int label[];
    } s_col; 
    

    You can't have flexible array member (double data[]) in the middle. Consider hardcoded array size or double *data

提交回复
热议问题