0
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.

4
  • 1
    The type struct line_rank is incomplete, because it has not be defined anywhere. Commented Sep 18, 2015 at 3:47
  • @pablo1977 I don't understand? The third last line of the code has the previous struct declared as line_rank? Commented Sep 18, 2015 at 3:48
  • 2
    No, there you have defined an anonymous struct and a global variable line_rank having this type. Commented Sep 18, 2015 at 3:50
  • @pablo1977 Ahhh, so it's a typedef issue as MikeCAT has answered. Cheers. Commented Sep 18, 2015 at 3:52

1 Answer 1

2

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];
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.