I'm currently working on a fairly large program (large to me, about 1k lines
) that utilizes more than a few multi-dimensional arrays. I'm trying to be mindful of how much memory my program consumes and how efficient it is.
Here's one array:
820 integers... about 3MB. I guess that's not "bad" per se, but the only numbers ever stored in this array are all <10 and >=0. You can see how this might bug me--all those extra bytes are used for nothing.
My question is... is there some other data type that might better suit my purposes? I have no need for the two billion or so upper limit of the int data type. However, it remains that any data type used must be able to be typecasted into an int and vice versa.
It occurred to me that a char data type might be able to store my data more efficiently... but is that feasible? It's char after all and I want #s. With all the millions of data types in windows.h... you'd think there's something that would do the trick?