> I believe enumerated constants start at 0 by default.
They do, and I pointed out your error.
Code:
int iLike;
printf("What fruit do you like?\n");
printf("1. Apple\n");
printf("2. Orange\n");
printf("3. Banana!\n");
printf("4. Lemon?\n");
scanf("%d", &iLike);
iLike++; /* the enum constants start from 0 in this example */
If the user enters, 1 for apple. They then like 1 + 1 = 2 (Banana), Rather than 1 - 1 = 0 (Apple).
In short you increased iLike when you should have decreased it. That means you go out-of-bounds when you try to access a "Lemon" for example. It's name would then be... according to you fruitname[5] (out-of-bounds) -- No, it's fruitname[3]. Run it through a debugger and see for yourself.
> As for the test, it was purposefully written such that it demonstrates the readability of enum constants versus "magic" numbers.
No excuse for errors