I've started learning C and have reached the point of enums. An enum is basically a preferred alternative to DEFINE
/ const int
, correct?
What's the difference between these two declarations?
#include <stdio.h>
// method 1
enum days {
Monday,
Tuesday
};
int main()
{
// method 1
enum days today;
enum days tomorrow;
today = Monday;
tomorrow = Tuesday;
if (today < tomorrow)
printf("yes\n");
// method 2
enum {Monday, Tuesday} days;
days = Tuesday;
printf("%d\n", days);
return 0;
}