Re: a quick malloc question

From: chaoith (aaa_at_aaa.com)
Date: 09/27/03


Date: Sat, 27 Sep 2003 06:38:36 +0800

drejcicaREMOVE@volja.net wrote:
> Hello,
> if I use a variable multiple times within my program, is it better to
> declare it as a pointer and malloc() it every time (if the value of the
> variable is changed many times)?

It is not the reason to use malloc().

>If it's not a pointer, does it lead to
> a memory leak?

Look into stdlib.h and see the malloc() declaration.

> However, if it is a pointer, I can use one and the same
> address every time I change its value.

Go to buy a book on C.