Women in Technology

Hear us Roar

  What I Hate About Your Programming Language
Subject:   C, C++, Java, maybe others - zeroth element arrays
Date:   2003-05-14 10:54:13
From:   anonymous2
Response to: C, C++, Java, maybe others - zeroth element arrays

why arrays indexed from zero? cos everybody is used to them. maybe if we all started indexing arrays from 1 back in the day it'd seem sensible, but it has become convention. i'd find it weird if i moved to a new language and found the arrays indexed from 1, it'd spongle all my for-loop logic & annoy me every time i forgot it.
Main Topics Oldest First

Showing messages 1 through 2 of 2.

  • C, C++, Java, maybe others - zeroth element arrays
    2003-05-14 14:39:09  anonymous2 [View]

    Naah, you don't really want me to reply with a list of languages that do suport arrays starting 'at one' do you:)
    Don't be worried if you ever encounter one though, those languages do not support for-loop logic either.
    You'll indeed need an all new logic:
    the first is in position one,
    the second is in position two,
    the Nth is in position N.

    Hey, I really do like C, but not really for business processing.
  • There's a zeroth element?
    2003-05-14 13:08:17  anonymous2 [View]

    Maybe I'm backwards, but I rarely use the zeroth element. I do know that C and its pointer arithmetic is why there is a zeroth element. But unless the problem absolutely requires it, I just ignore it like a bit of grissle on my steak.