Home:ALL Converter>When allocating dynamic array in C, is there a general rule to how much memory to allocate when the amount of memory that will be utilized is unknown?

When allocating dynamic array in C, is there a general rule to how much memory to allocate when the amount of memory that will be utilized is unknown?

Ask Time:2018-01-26T15:32:49         Author:termlim

Json Formatter

When allocating a dynamic array in C, is there any general rule on how much memory to allocate when the amount of memory that will be utilized is unknown?

For example, when dynamic memory allocation is for a string command line argument with no character limitation.

Author:termlim,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/48457275/when-allocating-dynamic-array-in-c-is-there-a-general-rule-to-how-much-memory-t
yy