In <f7*************************@posting.google.com>
re*******@21cn.com (Rex_chaos) writes:
I have allocated a array like
double a[1024];
We know that a 1-D array just like an 1-D pointer.
After reading the FAQ, we no longer "know" that! And we're supposed to
read the FAQ *before* posting!
So I wonder that
should I release the memory of the array myself like
free(a);
NEVER pass to free() a pointer value that was not obtained from one of
the *alloc functions.
There are three kinds of memory allocation in a C program:
Static allocation: the memory is allocated for the entire duration of the
program execution and there is nothing you can do about it.
Automatic allocation: the memory is allocated for the entire duration of
the block containing the object definition and automatically deallocated
when the program execution quits the block. Again, no programmer
intervention is possible.
Dynamic allocation: the memory is allocated as a result of on an *alloc
function call and stays allocated until the program calls free with the
pointer value returned by the corresponding *alloc function call (or
until it is reallocated with a realloc function call) or until program
termination.
Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email:
Da*****@ifh.de