Tim
Tim

Reputation: 1

I got an error expected expression before '[' token

error: expected expression before '[' token
msg_ship_detroyed([FLEETSIZE].name);

Please help me to fix this error. Thank you for your time.

Here is part of my code

typedef struct { int length; char name[20]; } Ship;
#define FLEETSIZE 3

Upvotes: 0

Views: 53

Answers (1)

chqrlie
chqrlie

Reputation: 144685

The tiny code fragment has a syntax error: [FLEETSIZE] cannot appear at the start of an expression.

Either you are not programming in C or there is something missing.

Posting a complete program would help diagnose this error in context.

Upvotes: 1

Related Questions