Lesson 5 of 5 40 min

Pointers & Memory Management

Pointers are what make C powerful — and dangerous if misused. Learn address-of (&), dereference (*), pointer arithmetic, malloc/free, and common pitfalls like null dereferences and memory leaks.
c
int x = 10;
int *p = &x;
printf("value: %d, address: %p\n", *p, (void *)p);

int *arr = malloc(5 * sizeof(int));
if (!arr) { perror("malloc"); return 1; }
// ... use arr ...
free(arr);
← Functions & Scope