Memory heap versus stack
What’s the difference between heap memory and stack memory
What does the garbage collector do to the heap memory
borrow checker runs at compile time in rust
few rules:
ownership - only 1 owner at a time
.clone creates another memory for that var
&x passes reference of x without chnagijg the ownership
bcoz if we pass the string, the pwner is passed and will get dropped once scope dies
this is called borrowing ( passing references )
borrowing rules:
- only 1 mutable reference OR can have as many immutable references
lifetime