package main
import (
"fmt"
)
func main(){
var str string = "hello,world"
fmt.Println(&str)
fmt.Println(&str[0])
}
I'm a complete rookie in golang. Just started learning for a few days. Here is my question:
compiled error: cannot take the address of str[0]
I searched <>, it says you can not take the address of character in a string, however I wonder why it is not allowed do this? Another confusion is that once you create a string, you cannot modify it anymore, does that mean the string is in constant space?