On writing C
22 December 2013A few days ago I had to write some C code again. I haven’t written a single line of C since freshman year. And that was 5 years ago. That is a long time and this little home assignment made me realize a few things.
In high school I already picked up some programming skills. The first year of university I lived off of these. Understanding new concepts and algorithms was easy and C seemed like just like any other programming language I had encountered up until that point. It had little quirks, but I was not bothered that much.
Using C was uncomfortable. I had to type much more, I missed strings and an infinite standard library. I just couldn’t understand why I had to re-implement all the string manipulation functions when somebody else have already done it, it’s all there and ready to be used. I couldn’t understand why I had to rebuild the building blocks instead of just using them and creating something worthy. Now I understand.
Now I know that learning the basics is invaluable. It is boring and tiresome, but it is a must. It has to be enforced upon you, otherwise an I-already-know-everything young titan would simply ignore it and die horribly when he has to really understand a problem to fix it.
Diving into C and the linux api after 5 years was interesting. I needed two days to catch up to speed. I’ve avoided manual memory management, zero terminated strings and obscure function names for a long time. After I got used to it again, it seemed like the world opened up. C felt liberating.
I felt like a god. I could create anything. The computer’s memory is my playground and I can shape it the way I like it. No one tells me how to allocate chunks of memory and how to use them. Close to the metal I felt like a child again. The constraints of higher level languages were all gone. It was like playing with Lego, but the instruction manual was out of reach and only my creativity could restrict me.
C is freedom. It is a burden and a gift at the same time. It’s pure engineering, when you can lose yourself in the nitty-gritty details of implementing something instead of focusing on the end goal and user satisfaction. It is the perfect playground, but it is poorly suited to be a first language for the CS students. I almost missed out on C, because of the bad memories and scars that I have due to not understanding it properly. I needed to spend 5 years writing high level stuff to really appreciate what C can offer.