簡體   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];

產生以下error: array type has incomplete element type ,它指向我提供的代碼的最后一行。

我到處都看過,似乎找不到與以這種方式操縱的結構有關的另一個問題。

您可能要添加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