Which of the following options will be the correct function declaration (at Line1) for the given code snippet and sample output?
Code Snippet:
type car struct {
name string
brand string
}
__________//Line1__________ {
newCar.name = "Civic"
newCar.brand = "Honda"
}
func main() {
setCar := car{
name: "Celica",
brand: "Toyota",
}
setCar.carSwap()
fmt.Printf("Your current car is: %v %v", setCar.brand, setCar.name)
}
Sample Output:
Your current car is: Toyota Celica |
func (newCar car) carSwap()
func carSwap(newCar *car)
func (newCar *car) carSwap()
func carSwap(newCar car)
To get all Go Programming Language - Assessment Exam questions Join Telegram Group https://grateful.prepflix.in/infy-lex-pdfs