There are different ways to create dynamic strings in C (with constant duration). After some googling, the main way to do this is to use realloc () .
The method I implemented is using linked lists with 32 bytes for each node.
I was wondering if there are any more efficient ways to solve this problem besides using realloc () and linked lists, and what are the cons and pros for each method.
EDIT The reason I do this is because I get dynamic data from the recv () socket and looked for a flexible way to store it without allocating huge amounts of data, not needed.
source
share