Newsgroups: comp.lang.c
Path: utzoo!henry
From: henry@utzoo.uucp (Henry Spencer)
Subject: Re: Should I free strtok() results?
Message-ID: <1990Apr10.182430.5656@utzoo.uucp>
Organization: U of Toronto Zoology
References: <6501@rouge.usl.edu>
Date: Tue, 10 Apr 90 18:24:30 GMT

In article <6501@rouge.usl.edu> pcb@gator.cacs.usl.edu (Peter C. Bahrs) writes:
>The string functions that return pointers to memory, should their
>results be freed?

"String" is not a real data type in C; those functions do not return
strings, they return pointers into the strings *you* supplied as arguments.
They do not allocate any storage, and consequently it is an error to apply
free() to their results.
-- 
Apollo @ 8yrs: one small step.|     Henry Spencer at U of Toronto Zoology
Space station @ 8yrs:        .| uunet!attcan!utzoo!henry henry@zoo.toronto.edu
