i have a piece of code:
struct myKeyword {
string name;
int id;
};
myKeyword keywords[]={{"include",INCLUDE}, {"void",VOID},{"main",MAIN},{"int",INT},{"float",FLOAT},{"cin",CIN},{"cout",COUT},{"if",IF},{"elseif",ELSEIF},{"else",ELSE},{"exit",EXIT},{"for",FOR},{"while",WHILE}};
int j=0;
cout<<keywords[0].id; //not able to access keywords.id part
flag=0;
for (j=0;j<11;j++) {
if (lexeme==keywords[j].name)
{
temp->assign(lexeme,keywords[j].id);
flag=1;
break;
}
}
getchar();
}
why cout<<keywords[0].id is not working?
thanks in advance