Answer the question
In order to leave comments, you need to log in
Is memory allocated when passing slice?
Good day!
Let's say I have an array of bytes and I need to turn it into a string.
To do this, I run through the array to the desired byte, create a slice and pass it to another function.
As I understand it, the slice is just a reference to the elements of the array, which means that memory will not be allocated?
Is an array with references to the elements of another array equal to a slice?
Answer the question
In order to leave comments, you need to log in
As I understand it, the slice is just a reference to the elements of the array, which means that memory will not be allocated?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question