vendredi 24 mars 2017

Using part of enum as array index

I have large enum for example:

enum { elem0, elem1, elem2, elem3 ...... elem1000 }

I would like to create an array of float numbers using just some of the enum elements. For example, I would like to have only three elements in array: elem0, elem7, elem999 and I would like to acccess them in similar style as this:

array[elem0]=123
array[elem7]=12.5
array[elem999]=15.6

Aucun commentaire:

Enregistrer un commentaire