printf("[display menu]"); char buf[32]; fgets(buf,30,stdin); switch (atoi(buf)) { case 1: /* do the 1 stuff */ break; case 2: /* do the 2 stuff */ break; case 3: /* do the 3 stuff */ break; default: printf("INVALID\n"); break; }