enums and array

is enums and array are the same? or should i really need those 2 in c++?
Enums and arrays are totally different concepts.

is enums and array are the same?

Why do you think they have different names?


or should i really need those 2 in c++?

Why do you think they exist in the language?
the idea behind an array is to hold multiple values. in c++ unless you are smart about it they have to be the same value. an enum(eration) is just really an abstraction. its really just giving ints meaningful names. for example:

1
2
3
4
5
6
namespace op {
    enum operator {
        plus = '+',
        minus = '-',
    };
}


op::op foo = op::plus; // can be translated to int foo = whatever_the_int_value_of_+_is
Last edited on
Topic archived. No new replies allowed.