In C, We define the character of a string as Char. So I want to change a character of a string in Go.
if sum%11 != int(str[strlen-1]) {
str[strlen-1] = byte(sum % 11)
//fmt.Printf("%T %T
", str[strlen-1], byte(sum%11))
} else {
fmt.Println(sum)
}
But it will report an error "cannot assign to str[strlen - 1]". Both str[strlen-1] and byte(sum%11) are uint8. Why is it wrong? How should I convert?