Re: How to free dynamically allocated array?
- From: "Krishanu Debnath" <krishanu.debnath@xxxxxxxxx>
- Date: 30 Aug 2005 01:33:57 -0700
Markus wrote:
> Hi,
>
> I have read the FAQ 6.16 on how to dynamically allocate a
> two-dimensional array.
>
> I do it like this:
>
> double** A = (double **)malloc(m * sizeof(double *));
> for(i = 0; i < m; i++)
> A[i] = (double *)malloc(n * sizeof(double));
>
> But how do I free it? I currently have only
>
> free(A);
>
> but I guess it is not enough.
>
> The FAQ is not clear about this.
>
for(i = 0; i < m; i++)
free(A[i]);
free(A);
Krishanu
.
- Follow-Ups:
- Re: How to free dynamically allocated array?
- From: Flash Gordon
- Re: How to free dynamically allocated array?
- References:
- How to free dynamically allocated array?
- From: Markus
- How to free dynamically allocated array?
- Prev by Date: Re: while (1) vs. for ( ;; )
- Next by Date: Re: while (1) vs. for ( ;; )
- Previous by thread: How to free dynamically allocated array?
- Next by thread: Re: How to free dynamically allocated array?
- Index(es):
Relevant Pages
|