Return structure with flexible array member

后端 未结 7 1840
栀梦
栀梦 2021-01-15 03:23

I need to return a structure with a flexible array member from a C function but can\'t figure out why it doesn\'t compile. I know that returning arrays can be achieved by en

7条回答
  •  囚心锁ツ
    2021-01-15 04:02

    As to the reason why you cannot convert double* to double[], you may refer to this question that was asked before.

    As to solve the problem, changing double data[]; to double *data; will work.

    New UPDATE:

    double* b = malloc(sizeof(double) * 1000);
    

提交回复
热议问题