C#

C is the operator’s language for the layer right above the hardware. The Linux kernel, every libc, every TLS implementation, every database engine, every modern interpreter (CPython, V8, Lua, Ruby, PostgreSQL) is mostly C. Nothing newer has displaced it where size, speed, predictability, and ABI stability matter together.

For the operator, C is the language for kernel modules, eBPF loaders, exploit primitives, shellcode wrappers, embedded firmware, and any tool small enough to be statically linked into a payload. Reading C is also a unit-level skill for reverse engineering: every disassembly the operator sees was emitted from a C-shaped intent.

Baseline. C11 / C17 is the working baseline; C23 features (_BitInt, constexpr, nullptr keyword, typeof) are called out where used. gcc and clang are interchangeable for almost everything; -Wall -Wextra -Wpedantic is on by default.

Default toolchain. gcc or clang, make (or cmake for anything multi-target), valgrind and AddressSanitizer for memory bugs, gdb or lldb for debugging, clang-format and clang-tidy for style and lint.

Setup#

Picking a compiler and getting the toolchain on the host.

Setup

gcc, clang, musl, glibc, make, cmake. Picking the compiler and bootstrapping a build.

Setup
Tooling

gcc, clang, ld, ar, nm, objdump, valgrind, ASan / UBSan, gdb, clang-format.

Tooling
Snippets

Single-line C idioms: MAX / MIN, bit twiddling, ARRAY_LEN, swap.

Snippets

Language#

The spec building blocks.

Syntax

//, /* */, ;, \, #. Comments, identifiers, keywords, literals, preprocessor, statements vs expressions.

Syntax
Variables

int x;, =, const, static, extern, register, volatile. Storage classes, scope, linkage, lifetime.

Variables
Types

char short int long, float double, signed / unsigned, size_t, ptrdiff_t, fixed-width stdint.h types, pointers, arrays, structs, unions.

Types
Operators

+ - * / %, == != < >, && || !, & | ^ ~ << >>, & *, ->, sizeof, ?:, ,.

Operators
Controls

if else, for, while, do while, switch / case, break continue return goto. Branching, loops, jumps.

Control flow
Functions

T name(params), prototypes, static, inline, variadic (va_list), function pointers, recursion.

Functions
OOP

No classes. Pattern: struct + function pointers + self first parameter. vtables, opaque handles, object lifecycle.

OOP

Patterns#

The layer above the spec.

Patterns

RAII via cleanup, error codes, return-buffer ownership, opaque handles, header / source split, defensive assert, X-macros.

Patterns
Errors

errno, strerror, perror, return codes, setjmp / longjmp, abort, assert, error conventions.

Errors

Data Structures#

The containers the operator either builds or pulls from third parties.

Structures

Arrays, structs, linked lists, hash tables, dynamic arrays. C has no built-in containers; build or import.

Data Structures
Algorithms

qsort, bsearch, memcpy, memmove, strstr, regex.h. The C standard catalogue.

Algorithms

I/O#

Talking to files, the network, the shell, and the OS.

I/O

stdio.h (fopen, fread, printf), unistd.h (read, write), sys/mman.h, formatting, buffers.

I/O
CLI

int main(int argc, char **argv), getopt, getopt_long, exit, EXIT_SUCCESS, stdin / stdout streaming.

CLI
Networking

BSD sockets (socket, bind, listen, connect), poll / epoll / kqueue, TLS via OpenSSL / mbedTLS.

Networking
Concurrency

POSIX threads (pthread_*), C11 <threads.h>, atomics (stdatomic.h), mutexes, signals, fork / exec.

Concurrency

Runtime#

The compile-link-load model and what happens between source and the binary.

Runtime

Preprocessor, compile, assemble, link. Static vs dynamic linking, ld.so, ELF, the C ABI, crt0, __attribute__.

Runtime

Ecosystem#

The standard library, POSIX, and the third-party catalog.

Libraries

Stdlib: string.h, stdlib.h, stdio.h. POSIX: unistd.h, pthread.h. Third-party: OpenSSL, zlib, libcurl, libuv, cJSON.

Libraries
Frameworks

GUI: GTK, Qt (C++ wrapper). Web: libmicrohttpd. Embedded: RIOT, Zephyr. Database: SQLite (the canonical embedded C library).

Frameworks

Practice#

The disciplines that keep C from biting.

Testing

Unity, Check, CMocka, Criterion, cmocka, fuzzing with AFL++ and libFuzzer.

Testing
Projects

End-to-end C projects, a port scanner, a kernel module, a shellcode loader, an eBPF probe.

Projects