Writing C that compiles is only half the job. This final module covers how to find bugs and run work in parallel without breaking it.
It starts with GDB, the standard debugger, which lets you set breakpoints, step through code, and inspect variables. It then moves to Valgrind for catching memory leaks and invalid memory access. It ends with concurrency: creating threads with pthreads and protecting shared data with mutexes to avoid race conditions.
Watch the lessons in order, then put everything together in the Projects section.
What a debugger is and how to use GDB in the Linux terminal: add breakpoints, watch variables, and pause and resume execution to find a function returning the wrong value.
NeuralNine walks through debugging a C program with GDB, from compiling with debug symbols to stepping through code and inspecting state.
Use Valgrind on a simple program to find two memory leaks, then patch them. Essential practice after the pointers and memory module.
CodeVault introduces threads in C with the POSIX pthread library: what a thread is and how to create and wait for one.
How to use a mutex to prevent race conditions in a multi-threaded C program using the POSIX pthread library.
A longer walkthrough: why use threads, creating and ending them, running several at once, and preventing race conditions with mutexes and condition variables.