Scoping question in C

John Vetterli jvetterli-zC6tqtfhjqE at public.gmane.org
Mon Jun 13 16:36:33 UTC 2005


On Mon, 13 Jun 2005, James Zhou wrote:
> I think an alternative might be the strdup() - string duplicate. But it
> brings another potential problem if the programmer forgets to explicitly
> "free" the space after the use. That is because strdup() actually allocates
> the memory space from heap to hold the copied string. :)

The advantage to the strdup approach is that you are writing your program 
to fit the data, rather than hoping that the data will fit your program.

JV
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list