MemC – See How C Uses Memory
Type C code, click Run or Step, and watch where variables and pointers live in memory
Quick Start (3 steps)
- Pick an example below or write your own C code
- Click Run to execute all at once, or Step to go line by line
- Watch the memory diagram update: Stack (local vars), Heap (malloc), and pointers
Try an example:
Your C code (must have main())
Controls
No memory to show yet
Click Run or Step to execute your code. The diagram will show where variables live: Stack (local vars), Heap (malloc blocks), and pointers between them.
Output (printf)
No output yet. Use printf("text") or printf("x = %d", x) to print.
What you'll see
- Stack — Local variables (e.g.
int x = 5) live here. Each function gets its own frame. - Heap — Memory from
malloc()orcalloc(). You must callfree()when done. - Pointers — Variables like
int* pstore addresses. The arrow (→) shows what they point to.