Should I convert FORTRAN code to C?
Robert Firth
firth at sei.cmu.edu
Sat Jun 18 01:54:30 AEST 1988
The following code, contributed by a C programmer, allocates dynamic
memory for a two-dimensional array:
> For this particuliar
> data structure, the subroutine is basically a one-liner:
>
> double **Create2DArray(w,h)
> int w,h;{ double **r;
> for(r=(double**)calloc(h,sizeof(*r));h-->0;r[h]=(double*)calloc(w,sizeof(**r)));
> return(r);}
Any Fortran programmer who seriously proposes to convert to C would, in
my opinion, be advised to study this example very carefully. Verbum
sapienta sufficit.
More information about the Comp.lang.c
mailing list