Programming Languages6 min read

Everyone Should Suffer Through Splitting a String in C

I used to think C was useless. Old, annoying, and designed to make students miserable. Coming from Python and JavaScript, it felt like unnecessary suffering.

Then I tried to split a string in C.

Do you know how insane that is? In Python it's s.split() and you're done. In C, you're suddenly Googling strtok() like your life depends on it. And then you find out strtok() mutates your string, uses internal state, breaks if you're not careful, and absolutely will screw you over if you try to reuse the original string later.

So now you're copying strings, allocating memory, tracking tokens, making sure you don't segfault, and remembering to free everything at the end. Miss one step and the program either crashes or quietly ruins your day.

That's when it hits you: strings in C are not strings. They're just memory. Nothing is safe. Nothing is automatic. The computer does exactly what you tell it, even if what you told it was stupid.

You can't bullshit your way through C. If you don't understand what you wrote, it shows immediately.

Weirdly, that was the first time I felt like a real programmer. Not a script kid or a framework junkie, but someone actually dealing with how computers work instead of just vibes and abstractions.

I don't write C every day, and I don't want to. But after fighting strtok() and pointers and memory, every other language feels easy. Bugs make more sense. Performance isn't a mystery anymore.

C sucks sometimes. But it teaches you things that stick.

And honestly, everyone should suffer through splitting a string in C at least once.

Back to all articles