I am trying to implement a function to change state of the menu, but my reference is lost when it leaves the function:
void gotoLowerlevel(Menu *item)
{
if (item->chld != 0x00) {
item = item->chld;
}
}
The function call is done in this manner (currentState
is a pointer to struct Menu
):
case ENTER:
if (cnsle->inMenuFlag == 0)
{
cnsle->inMenuFlag = 1;
cnsle->currentState = cnsle->root;
gotoLowerlevel(cnsle->currentState);
displayMenu(cnsle->currentState,&cnsle->display);
}
I have no idea why this isn't working. Any ideas?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…