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 you'll learn in this C course

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 38,035 students in the Learn Memory Management in C course

Read reviews of their learning experiences

A great C programming course that gits you gud on the language and beefs you up with its quintessential strengths in managing computer resources effectively.

(5/5)
Jerry  profile image

Jerry

Puerto Rico

real great course, i finally understand pointers... and the other stuff.

(5/5)
Matei Gilca profile image

Matei Gilca

Romania

Was tough to understand at some parts, but was a very well designed course that made the gears turn a lot!

(5/5)
d3rpy d3rp_d3rp profile image

d3rpy d3rp_d3rp

Canada

Gives an overview of C and manual memory management - not too deep but is enough to get your feet wet. Some parts can be a little bit challenging for a beginner. Really cool course!

(5/5)
Khang Phùng Bảo profile image

Khang Phùng Bảo

Vietnam

good course told a lot of c basics, experience of working some low level things, got it naturally comming, don't know what i build, just build it

(4/5)
Muhammad Burhan Qamar profile image

Muhammad Burhan Qamar

Pakistan

A fantastic dive into how everything you take for granted in other programming languages works. From the stack and the heap, all the way through to managing arrays and resolving types. If you've only ever used Python, this is a bit of a curve but by the end of it you will understand Python better. You'll also miss strings.

(5/5)
John McLeish profile image

John McLeish

Australia

I think it's a very good course useful to grasp how memory works inside of our programs

(5/5)
Mauro Baldanzi profile image

Mauro Baldanzi

United Kingdom

Favorite course so far - great balance between challenging content and incremental complexity increase so that it is still doable without getting into high frustration moments.

(5/5)
Kaloyan Kirilov profile image

Kaloyan Kirilov

Bulgaria

tough but fair

(5/5)
Kuot Thiik profile image

Kuot Thiik

Melbourne, Victoria

Showing 1-9 of 643

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

It mostly doesn't. You do. Local variables live on the stack and are freed automatically when a function returns. Anything you allocate on the heap with malloc stays there until you call free... anyways we cover all that stuff in this course.