PDA

View Full Version : Efficiency of a small multi-dimensional array


Halide
09-18-2003, 02:02 PM
Hey...quick question. I decided to tackle a simple problem by using a multi-dimensional array to hold a "table" of values.

Here it is:
const float GAS_RATES[4][2] = {{ 70, 0.05 }, // each row holds a range "floor" (exclusive),
{ 170, 0.025}, // followed by the rate in dollars.
{ 400, 0.015}, // the next row holds the range "ceiling" (inclusive)
{10000, 0 }}; // i.e. [i][0] < x <= [i + 1][0]

Is this a waste of storage since I'm storing integers inside the float array? Stupid question, I know... Just wondering since I'm a newb! :D

myjay610
09-19-2003, 01:50 AM
well it looks like you have some floats that are being stored in there... like .05 and .025...