Array of strings

You may like to use an enum, a way to bind an identifiers to integers:

enum Items {apple = 1, box, carnage, delicious};

and in your code, apple will work just like 1, box as 2 and so forth.

You may want to start thinking of zero as a perfectly good number; array indices run from 0 to N - 1 if N is the total number of elements in an array.

enum Items {apple, box, carnage, delicious};

where not saying where to start, the default is 0.

Most real code uses 0 .. N - 1, you may find some arguments about that.

And yes, less RAM intensive.

a7

1 Like