MCPcopy
hub / github.com/hoanhan101/ultimate-go / inspectSlice

Function inspectSlice

go/language/slice.go:283–288  ·  view source on GitHub ↗

inspectSlice exposes the slice header for review. Parameter: again, there is no value in side the []string so we want a slice. Range over a slice, just like we did with array. While len tells us the length, cap tells us the capacity In the output, we can see the addresses are aligning as expected.

(slice []string)

Source from the content-addressed store, hash-verified

281// While len tells us the length, cap tells us the capacity
282// In the output, we can see the addresses are aligning as expected.
283func inspectSlice(slice []string) {
284 fmt.Printf("Length[%d] Capacity[%d]\n", len(slice), cap(slice))
285 for i := range slice {
286 fmt.Printf("[%d] %p %s\n", i, &slice[i], slice[i])
287 }
288}

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected