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

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