We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

Learn Memory Management in C

Get close to the metal: pointers, the stack, the heap, and a tiny garbage collector you build yourself.

What will you learn?

Memory management is something that every programmer needs to deal with and understand at some point. If you're used to working with languages and tools that handle it for you, this course will teach you how all that works under the hood. You'll even build your own garbage collectors from scratch. This course will teach you the C basics you need for the course, but it's not a course about C, it's about memory.

Chapter List

1
C Basics
Introduction to the basics of the C programming language
2
Structs
Understand how C structs work and how they're laid out in memory
3
Pointers
You thought pointers were hard? Wrong. Let's figure them out together.
4
Enums
Learn how to use enums (enumerations) in C to create a set of named constants.
5
Unions
Unions in C are not the same as they are in TypeScript. Let's grok C unions.
6
Stack and Heap
Understand the difference between allocating memory on the stack and the heap
7
Advanced Pointers
Let's practice some more advanced pointer concepts - like pointers to pointers
8
Stack Data Structure
Build a stack in C using structs and pointers and understand where the memory is allocated
9
Objects
Implement your own object system for later use in your garbage collection algorithms
10
Refcounting GC
Implement a simple reference counting garbage collector from scratch in C
11
Mark and Sweep GC
Implement a basic mark and sweep garbage collector and understand its tradeoffs with refcounting

Join 33,312 students in the Learn Memory Management in C course

Read reviews of their learning experiences

This is probably my favorite course I've taken so far. I finally feel like I have a better understanding of structs and pointer, and the concept of managing memory is way more approachable than it was before. 10/10, would recommend

(5/5)
Adam Guzman profile image

Adam Guzman

California

who thought that managing memory would be fun and easy. learned a lot

(5/5)
Jisair C54 profile image

Jisair C54

United States

Get ready for a challenge!

(3/5)
Daniel  profile image

Daniel

Brasília, Brasil

This was a great course. Really surprised at how difficult I found it to work and think in C. Motivates me to try to find opportunities to work in it.

(5/5)
Stevan Freeborn profile image

Stevan Freeborn

Olathe, Kansas

Fantastic course that goes from the very basics of C, to a very prototyped version of a programming language! It has endowed me with an understanding of many things unrelated to this course, for instance, I feel I'm a better Java developer now!

(5/5)
Anto"nino" Cangialosi profile image

Anto"nino" Cangialosi

Pisa

Even though it wasn't the main goal, this course really helped me visualise structures and pointers better, for which I'm grateful. It was interesting to see how the language works and takes space. I had a hard time understanding what the author was explaining in some lessons though.

(4/5)
Laura  profile image

Laura

France

The final section on the mark-and-sweep garbage collector was really difficult to follow. Even though I managed to finish the course, I'm still scratching my head trying to understand how it all fits together.

(4/5)
Sahib  profile image

Sahib

Canada

Makes you feel like a real programmer

(5/5)
alfons  profile image

alfons

United States

A course that will truly make you fall in love with programming! You get to the meat of the thing and now you can brag that you know C!

(5/5)
Akram Naser profile image

Akram Naser

Switzerland

Showing 1-9 of 529

or view more reviews

Mediocrity doesn't cut it anymore

The only way to become a great developer is to write a lot of code

Avoid tutorial hell

by writing a ton of code

Stay motivated with

a game-like curriculum

Build portfolio projects

to prove your skills

Delve deeper

into foundational concepts

Learn flexibly online

without interrupting your life

For 1% the price of college

to minimize your financial risk

Frequently asked Questions

Got questions? We've got answers

Yes! It's free to create an account and start learning. You'll get all the immersive and interactive features for free for a few chapters. After that, if you still haven't paid for a membership, you'll be in read-only (content only) mode.