I'm new to SO and often stuck about questions on C++ (and author is claiming it with tags or inside post), but OP shows only C-style code without any trace of C++. Also, such threads may look like that OP is learning C++.
I.e.: using enum for an array index in c++
How to answer such questions?
- Open a door for OP to a brave new world of C++ (enum classes, etc.). It is good chance that topic starter get new knowledge through that, but also a big chance, that OP still true to C subset of C++, and your answer getting rejected, and your work is useless.
- Answer like anything fine and provide dirty C-stylish workaround.
- Avoid such questions like I do now.