-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
9 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Dynamic C-String Splitting | ||
### This function can be used for dynamically splitting a C-string on a given delimiter when the string length is not known. | ||
There are two locations within the code where modifications are possible: | ||
+ The initial capacity of the split array can be changed on line 17 | ||
+ The split array resizing logic can be changed on line 38 | ||
|
||
Changing the array resizing logic allows either space or time efficiency to be given priority. | ||
Currently, the array size is doubled on each resize to minimize the calls to 'realloc' without wasting lots of space. | ||
Alternatively, you could simply add one to the array size which would cause 'realloc' to be called more but waste zero space in memory. |