I am confused about when to use macros or enums. Both can be used as constants, but what is the difference between them and what is the advantage of either one? Is it someho
Note there are some differences between macros and enums, and either of these properties may make them (un)suitable as a particular constant.
sizeof(int)
. For arrays of small values (up to say, CHAR_MAX
) you might want a char foo[]
rather than an enum foo[]
array.enum funny_number { PI=3.14, E=2.71 }
.