Divide and C

Dan Bernstein brnstnd at kramden.acf.nyu.edu
Mon Apr 1 06:36:27 AEST 1991


In article <b7mN01vS4cVi00 at amdahl.uts.amdahl.com> lamont at amdahl.uts.amdahl.com (Duane Richard LaMont) writes:
> 	++((int *) array)[val];
> However, if your program uses arrays of pointers to arrays of
> integers, the above won't work and there is no counterpart solution.

This is a common argument of Fortran programmers against the common C
trick of keeping a table of pointers to each row of an array. It's an
incorrect argument. You can allocate the array contiguously, and use the
pointer to the first row *exactly* the same way as ``array'' in the
above example.

(Btw, I'm not accusing you of being a Fortran programmer. :-) )

---Dan



More information about the Comp.lang.c mailing list