I have seen this question, but still didn't get it, so here's what I know (it might be incorrect):
- Initializing a variable of type
Stringallocates memory on the heap and stores a pointer to that memory on the stack. - Initializing a variable of type
&strstores a pointer on the stack, and I'm assuming that pointer points to astron the heap.
If that's the case - if both String and &str store pointers on the stack pointing to memory locations on the heap - does that mean String and str (not the reference) are the same?