c - Do I need to free the returned pointer from localtime() function? -
i reading manpages time.h
. got far:
time_t = time(0); struct tm * local = localtime(&now);
now can work time, far good, not find information if duty free()
variable local
or not.
quoting man page
the 4 functions
asctime()
,ctime()
,gmtime()
andlocaltime()
return pointer static data , hence not thread-safe. [...]
so, need not free()
returned pointer.
Comments
Post a Comment