Xref: utzoo comp.lang.fortran:772 comp.lang.c:10777 Path: utzoo!attcan!uunet!husc6!bloom-beacon!mit-eddie!bbn!rochester!pt.cs.cmu.edu!sei!sei.cmu.edu!firth From: firth@sei.cmu.edu (Robert Firth) Newsgroups: comp.lang.fortran,comp.lang.c Subject: Re: Should I convert FORTRAN code to C? Keywords: language conversions, FORTRAN, c Message-ID: <5917@aw.sei.cmu.edu> Date: 17 Jun 88 15:54:30 GMT References: <2742@utastro.UUCP> <20008@beta.UUCP> <224@raunvis.UUCP> <3415@ut-emx.UUCP> Sender: netnews@sei.cmu.edu Reply-To: firth@bd.sei.cmu.edu.UUCP (Robert Firth) Organization: Carnegie-Mellon University, SEI, Pgh, Pa Lines: 15 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.