Path: utzoo!mnetor!uunet!husc6!hao!ames!pasteur!ucbvax!cbosgd!cbdkc1!pmd From: pmd@cbdkc1.ATT.COM (Paul Dubuc) Newsgroups: comp.lang.c Subject: Re: Allocating a two-dimensional array Message-ID: <2766@cbdkc1.ATT.COM> Date: 18 Jan 88 20:40:09 GMT References: <1050@ogg.cgrg.ohio-state.edu> Reply-To: pmd@cbdkc1.UUCP (Paul Dubuc) Organization: AT&T Bell Laboratories; Columbus, Ohio Lines: 23 In article <1050@ogg.cgrg.ohio-state.edu> spencer@ogg.cgrg.ohio-state.edu (PROCEED) writes: }Maybe this can't be done. Maybe I'm not thinking about it the right way. }But I can't figure out how to dynamically allocate a two-dimensional }array of floats. (I have to have an N by N matrix of floats, but don't }know N beforehand.) Can anyone help me on this one? Thanks. First allocate an array of N pointers to N arrays of floats, then allocate N arrays of N floats and assign the resulting pointers to the elements of the first array. float **fa; fa = (float **)calloc(N, sizeof(float *)); for(i=0;i