Skip to content

rust-lab-navahas/stack-heap-peek

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stack vs Heap Peek

I poke around memory addresses to see what’s happening with stack variables and heap allocations. No deep systems programming here, just me being curious.

What it does

  • main sets up a number on the stack, grabs its address (the “base”).
  • show:
    • Prints the value.
    • Shows the stack address where it lives.
    • Calculates how far it is (in bytes) from the base address.
  • heap_example:
    • Allocates a number on the heap using Box.
    • Turns it into a raw pointer.
    • Prints the value and address (unsafe block because raw pointers are spicey).

Sample output (yours will vary)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages