a style question

Jim Giles jlg at lanl.gov
Sat Oct 6 06:46:07 AEST 1990


>From article <2544 at cirrusl.UUCP>, by dhesi%cirrusl at oliveb.ATC.olivetti.com (Rahul Dhesi):
> In <1990Oct4.152246.438 at nntp-server.caltech.edu>
> manning at nntp-server.caltech.edu (Evan Marshall Manning) writes:
> 
>>And this is where the combination of a background in FORTRA[N|SH] and
>>variables named "i" will bite you.  In C it's the (i+1)th element in
>>the series.
> 
> Er, no.  Some series start with a zero-eth element.  They do, they
> really do.  Not in Fortran, perhaps, but in mathematics, yes.

Some series begin with zero in Fortran as well.  It is only C in the
family of commonly available languages which doesn't allow the user
to decide for himself what the subscript range of an array should be.
Fortran, Pascal, Modula, Ada, etc., all allow the subscript range to
have independent lower and upper bounds set for each rank of an array.
Most of these languages require both bounds to be explicitly specified
in the declaration.  Fortran allows the extent to be given alone - in
which case the lower bound of 0ne (1) is selected as a default.

J. Giles



More information about the Comp.lang.c mailing list