enum in an array

Hello, how can i use a enum with 3 constants in another array in my program?

enum:
 
  enum State { free, full, marked };


...

then i have a class with arrays in it(in private pointer, in konstruktor array with new [size] created:
 
  int *state;


 
  ..., state( new E[this->nmax]() ),...


i want my array state[nmax] now to have the 3 types free=0, full=1, marked=2.

so i can set certain spaces of my array in my other methods to one of theese values, like
state[posx] = free;
if(state[posy] = full) break;

is that possible?
1
2
3
4
5
6
7
8
9
 enum State { free, full, marked };
 State state[10];

state[5] = full;

if (state[3] != free)
{
   // blah
}


in your code it's going to be
State* state;
thx alot, works :)
Topic archived. No new replies allowed.