in reply to Re^2: Use Hash? Array? Still confused after all these years.
in thread Use Hash? Array? Still confused after all these years.

You are right on all counts. In c, you create a buffer overflow (underflow?) unless you are careful w/ your pointer arithmatic. php I believe doesn't mind. Perl, yeah.

It's fairly universal to say non-negative numbers though, on the concept level. But that's a preference in teaching the concepts, eh? :)

----
Give me strength for today.. I will not talk it away..
Just for a moment.. It will burn through the clouds.. and shine down on me.

  • Comment on Re^3: Use Hash? Array? Still confused after all these years.

Replies are listed 'Best First'.
Re^4: Use Hash? Array? Still confused after all these years.
by brian_d_foy (Abbot) on Jul 22, 2005 at 03:16 UTC

    I don't say "non negative numbers" either, because you can't use most "non negative numbers" for array indices. I say "counting numbers", "whole numbers", or "cardinal numbers" depending on my mood. It's not really a teaching preference so much as accurately describing the concept.

    --
    brian d foy <brian@stonehenge.com>
      Which non negative numbers aren't usable?

      ----
      Give me strength for today.. I will not talk it away..
      Just for a moment.. It will burn through the clouds.. and shine down on me.

        Pi? 0.06? Rational numbers (negative or not) are not usable array indices.