Skip to content

Function for dynamically splitting a C-string on a given delimiter when the string length is not known.

License

Notifications You must be signed in to change notification settings

B3W/Dynamic-C-String-Split

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 30
  • The split array resizing logic can be changed on line 50

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.

About

Function for dynamically splitting a C-string on a given delimiter when the string length is not known.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published