PREV INDEX NEXT

Author: Unknown
Subject: example.c getline and free
Date: Friday, 20 Mar 2020, 04:23:10

could you explain what is going on in example.c with regard to getline() and free(line)? 

line is set to NULL initially, before getline() is called for each line in stdin. each time getline() is called, is new memory allocated? what is line during each call? why is only one free() required?

then, at the next chunk, why can line be used again so many times?
PREV INDEX NEXT