Splitting Strings in C - YoungForest
[Abstract] Recently, while working on a C language problem, I needed to split a string. I originally wanted to write it by hand, which would not be too troublesome, but then I thought: other languages all have library functions for splitting strings, so how could C not have one? I searched online, and sure enough, such a function exists and is quite useful. I summarize it here. In the C language manual, it is easy to find the usage of strtok. One thing to note is that, except for the first call, the first argument should be passed… Read more