package main
import (
"fmt"
)
func change(s ...string) {
fmt.Printf("#1 address of s[0] is %p and it's content is %s and it's len is %d \n", &s[0], s, len(s))
s[0] = "Go"
s = append(s, "playground")
fmt.Printf("#2 address of s[0] is %p and it's content is %s and it's len is %d \n", &s[0], s, len(s))
}
func main() {
enough := make([]string, 10, 10)
enough[0] = "The"
enough[1] = "First"
change(enough[0:2]...)
fmt.Printf("111111address of enough[0] id %p and it's content is %s and it's len is %d \n", &enough[0],
enough, len(enough))
notEnough := make([]string, 2, 2)
notEnough[0] = "The"
notEnough[1] = "Second"
change(notEnough[0:2]...)
fmt.Printf("2222222address of notEnough[0] id %p and it's content is %s and it's len is %d \n", ¬Enough[0],
notEnough, len(notEnough))
/*
In the second case, the "append" function of change() creates a new array of double size and returns
the pointer to it. s now points to this new array. But in the main function nowEnough still points to the
old array of size 2.
*/
}