Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Slices quiz

Question

Why, for the previous example, the lengths of a and b are different?

a and b have the same lengths

b refers the same data as a, but it has no length constraints so 5 is simply appended in place

b is allocated a new memory region when 5 is concatenated to it

operator ~ works for slices, but it has no impact on static arrays