site icon

C

The C programming language

C is the lingua franca of programming. Not to say it's a good language, but it was the best choice for a very long time, and sometimes still is. My beloved, my nemesis, the thorn in my side. One of the distinguishing features of C is it's ability to dynamically allocate memory, and operate at a low level by default with very little, if any, side-rails. It's fast in the same way that sending a package by cannon is fast - it's fast, sure, but the consequences might not be worth it. At a low enough level it's all 1's and 0's, so it can be flexible, so flexible in fact you can bend over and blow your foot off with it.

Some might even say C is violent.

The United States government prefers that you not write it

strings

Strings are just arrays of bytes. Each byte probably represents a character, but not all the time. Ensure a particular string has the encoding you expect before you do anything character-wise, or ignore encoding and just move bits around. The length of a string, or rather the number of bytes to allocate when handling strings, is a source of great consternation.

historical foot guns to ruin your day

evaluating the following:

2 == 2

will return a value of 1

evaluating the following

0 == 1

will return a value of 0

Methods can and do return things other than 0 or 1 to represent a boolean-like state- that being said, you can generally assume a returned value equal to 0 to mean success, and != 0 to mean a failure of some kind (though don't expect it to be anything in particular besides not 0)