memory_map.txt The memory locations are different each time the program runs. Looking in demo_output.txt for one of these runs, I collected a few of the addresses to see where in memory different parts of the program ended up. Here's what I get. Note that if you're looking at the output of objdump or gdb's dissasm, consecutive lines are at increasingly higher addresses ... which is the opposite of the direction of increasing memory in the picture below. $ gdb demo (gdb) start (gdb) disass swap Dump of assembler code for function swap: 0x0000555555554818 <+0>: mov (%rdi),%eax lower address 0x000055555555481a <+2>: mov (%rsi),%edx 0x000055555555481c <+4>: mov %edx,(%rdi) 0x000055555555481e <+6>: mov %eax,(%rsi) higher address 0x0000555555554820 <+8>: retq End of assembler dump. In gdb, the location of the stack can be found from the %rsp (stack pointer) register, with the "x $rsp" or "info reg" command. (gdb) break *swap + 4 // break at line 4 of swap (se "help break") (gdb) continue It's another demo.c !!! -- part 0 -- inputs[] is at 0x7fffffffe290 What is your favorite color? ... never mind. ;) -- part1 -- before: n1 = 12, n2 = 34, n3 = 5, n4 = 0 (fdb) x $rsp 0x7fffffffe298: 0x55554c17 So at this point, the address of the stack is 0x7fffffffe298 . The value that's there is 0x55554c17 , which is the current return address, which is just after "callq swap" in swap_and_stuff , which you can see with "disass swap_and_stuff". Anyway, here's a layout of some of the addresses to see what's where, using the same "high is on top" convention that the lecture notes use, and which is common when talking about the stack "growing downward". --- memory locations in demo --- ... high memory ... 0x_7ffe_5fbd_5f80 g in part1 (in stack) | stack | (i.e. local variables) 0x_7ffe_5fbd_5f30 inputs[0] in part0 (in stack) | ↓ expands down .... 0x_5607_a4db_06f0 node a (in heap) | ↑ expands upward | heap 0x_5607_a4db_06d0 node b (in heap) | (i.e. dynamic , malloc) 0x_5607_a45a_ad2f main (code) | user code | loaded when 0x_5607_a45a_a848 part 0 (code) | program starts ... low memory ... --------------------------------------