I'm starting to learn go and need to fill popular the different structs with their values. I thought about creating an array of structs and trying to use a for to fill in the fields but a
invalid operation: p[1].burst[i] (type int does not support indexing)
The question is whether it is possible to do something of the type to fill the values or if there is any other way to do it
package main
import (
"fmt"
)
type process struct{
burst int
t_chegada int
}
func main(){
p := make([]process,10)
var n_processo int
fmt.Printf("Número de Processo: ")
fmt.Scanf("%d", &n_processo)
for i := 0; i < n_processo; i++ {
fmt.Printf("Burst Processo P%d: ", i)
fmt.Scanf("%d\n", &p[1].burst[i])
fmt.Printf("Tempo de Chegada P%d: ", i)
fmt.Scanf("%d\n", &p[2].t_chegada[i])
}
}