ANSI C
The lingua franca of Unix, from which modern operating systems like Linux, BSD's and MacOS, are derived from in some way or another.
It is a systems implementation language, which means that it allows some very abstracted manipulation of what would normally be low-level data, like memory locations and such. It has been called "Portable Assembly" for this reason.
void (*fn_array[])(type *) = {fn_name1, fn_name2, ...}
Array of function pointers.
`var++`
- return the value of `var` and then increment.
`++var`
- increment the value of `var` then return its value.
while (*ptr)
{
/* Do something with *ptr */
ptr++;
}
Iterate over array via pointer math, will only work if the last array item is NULL. Useful for strings.
while (*ptr1++ = *ptr2++) ;
Copy contents of one array to another
Types in C differ in bit length. Otherwise, everything is just a bit pattern.
Type | Bit Length | Range |
---|---|---|
signed char | 8 bits | -127, +127 |
unsigned char | 8 bits | 0, 255 |
signed short | 16 bits | -32767, +32767 |
unsigned short | 16 bits | 0, +65535 |
int | implementation-specific | see left. |
The types I listed above are the ones I usually work with.
- Bitwise AND extracts.
- Bitwise OR sets.
- Bitwise XOR toggles.