I want to create an array of structures:
typedef struct
{
int id;
int department;
}employee;
int main(int argc, char *argv[])
{
int i;
employee job[3]; ////////////////error
for (i=0;i<3;i++)
{
//do something
}
return 0;
}
the issue is that when I want to compile I got the following error:
syntax error before ‘;’ token and points to the line that I marked
Any help?
Thanks
That code, as it stands alone, is fine, as per the following transcript:
. Some things you may want to check are:
#defined something likeemployeeorjob?employeeis spelt identically in both places?A good first start would be to comment out the errant line and see if you get the error on the following line. That should narrow it down to either that line (no error) or a previous line (still have error).
You can see the entire file in hex mode (looking for funny characters) if you do something like:
(under Linux – Windows I’m not sure though, if you have
gvim, you can convert it to hex with a menu item).