Course Hive
Search

Welcome

Sign in or create your account

Continue with Google
or
Cap. 8 – Agrupamentos de Dados – 8. Slice: a surpresa do array subjacente
Play lesson

Aprenda Go 🇧🇷 - Cap. 8 – Agrupamentos de Dados – 8. Slice: a surpresa do array subjacente

5.0 (2)
47 learners

What you'll learn

This course includes

  • 21.3 hours of video
  • Certificate of completion
  • Access on mobile and TV

Summary

Keywords

Full Transcript

- Isso tudo aqui a gente já viu: - Toda slice tem um array subjacente. - Um slice é: um ponteiro/endereço para um array, mais len e cap (que é o len to array). - Exemplo: - x := []int{...números} - y := append(x[:i], x[:i]...) - pkg/builtin/#append: "If it has sufficient capacity, the destination is resliced to accommodate the new elements. If it does not, a new underlying array will be allocated." - Ou seja, y utiliza o mesmo array subjacente que x. - O que nos dá um resultado inesperado. - Ou seja, bom saber de antemão pra não ter que aprender na marra. - Go Playground: https://play.golang.org/p/BBJLuIjU_i

Course Hive

Continue this lesson in the app

Install CourseHive on Android or iOS to keep learning while you move.

Related Courses

FAQs

Course Hive
Download CourseHive
Keep learning anywhere