LJ Archive

Listing 3

char *item_names[] = {
   "files",
   "messages",
   "tapes",
   "penguins",
   "floppies"
};
...
if((index >= 0) && (index <= 4))
   items = item_names[index];
else
   items = "unknown items";
printf("You have %d %s\n", quantity, items);
LJ Archive