/ Published in: C
Realloc memory at every X steps. Useful when allocating fixed number of items (in this case chars).
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
char *variable; int size = 120, tmpsize = 0; while ( ... ) { //Realloc memory tmpsize += 40; if (tmpsize > size) { size += 120; } }