简体   繁体   中英

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.

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 char line_t[MAX_INPUT + 1];

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

line_rank lines[MAX_LINES + 1];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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