C

The language of operating systems and embedded work.

C is taught here in 12 lessons, running from Syntax and the compiled toolchain through to Portability, standards and disciplined C. Each lesson takes one topic, shows the working code, and links onward to the next, so the course can be read straight through in order.

TrackProgramming Languages
Lessons12
LevelBeginner to intermediate
Reading timeabout 3 hours
PrerequisitesNone beyond being able to open a text editor

Lessons

  1. Syntax and the compiled toolchainHow the preprocessor, compiler and linker turn a .c file into a program, and the core syntax you write in between.
  2. Pointers and memoryAddresses, pointer arithmetic, where objects live, and the malloc and free rules that keep a program alive.
  3. Structs, files and undefined behaviourGroup related data, read and write files without leaking descriptors, and recognise the undefined behaviour the compiler is allowed to punish.
  4. Setting up a C toolchain: compiler, make and gdbInstall gcc or clang, choose a language revision, turn on the warnings that matter, and drive the build with make and gdb.
  5. Control flow, functions and the standard libraryBranch and loop without off-by-one bugs, declare functions before use, and use printf and scanf without the classic traps.
  6. Arrays, strings and the string libraryStop confusing arrays with pointers, size buffers correctly, and know which string functions are dangerous and what to use instead.
  7. Dynamic memory patterns and allocation bugsOwnership rules, growing buffers, flexible array members, and how to find leaks, double frees and off-by-one writes with valgrind.
  8. Preprocessor, headers and multi-file projectsUse macros without the traps, put declarations in headers and definitions in .c files, and control visibility with static and extern.
  9. Building and linking: static and shared librariesRead a symbol table, build archives and shared objects, get link order right, and debug the undefined reference errors that follow.
  10. Data structures in CBuild linked lists, dynamic arrays, hash tables and binary search trees by hand, and free a whole structure without leaking.
  11. Debugging with gdb, sanitizers and valgrindBreakpoints, watchpoints, core dumps, and the sanitizers that find in seconds what a debugger finds in an hour.
  12. Portability, standards and disciplined CFixed-width types, endianness and alignment, the difference between undefined and unspecified behaviour, and warnings as errors.

More in Programming Languages

C++ C# Scala Lua Dart VBA

FAQ

How long does the C course take?
It has 12 lessons, about 3 hours of reading. Expect roughly twice that if you type out and run every example.
Do I need prior experience for C?
No. This is the first course in Programming Languages, so it starts from the beginning and assumes no background.
What should I read after C?
Continue with C++ (13 lessons), the next course in Programming Languages.