简体   繁体   English

C-数组类型的结构数组的元素类型不完整

[英]C - Array type has incomplete element type for array of structs

typedef char line_t[MAX_INPUT + 1];

struct {
    line_t line;
    double score;
    int linenumber;
} line_rank;

struct line_rank lines[MAX_LINES + 1];

Produces this : error: array type has incomplete element type which refers to the last line in the code I have provided. 产生以下error: array type has incomplete element type ,它指向我提供的代码的最后一行。

I have looked everywhere and can't seem to find another question relating to structs manipulated in such a way. 我到处都看过,似乎找不到与以这种方式操纵的结构有关的另一个问题。

You may want to add typedef and delete struct . 您可能要添加typedef并删除struct

typedef char line_t[MAX_INPUT + 1];

typedef struct {
    line_t line;
    double score;
    int linenumber;
} line_rank;

line_rank lines[MAX_LINES + 1];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM