#include <stdio.h>void playgame(){printf("Play game called");}void loadgame(){printf("Load game called");}void playmultiplayer(){printf("Play multiplayer game called");}int main(){int input;printf("1. Play game\n");printf("2. Load game\n");printf("3. Play multiplayer\n");printf("4. Exit\n");printf("Selection: ");scanf("%d",&input );switch( input ){case1:/* Note the colon, not a semicolon */
playgame();break;case2:
loadgame();
Enterkey();
playgame();break;case3:
playmultiplayer();break;case4:printf("Thanks for playing!\n");break;default:printf("Bad input, quitting!\n");break;}getchar();
enter code here
}
Instead of using the input variable to decide which action to do, you could deal with another variable representing the current state. With that approach, you should call playgame() either from the case option '1' or from the new state just created.