package main import "fmt" func main(){ x,y := 1,2 swap(&x,&y) fmt.Println(x,y) } func swap(a,b *int){ t := *a *a = *b *b = t } //修改不成功 //func swap(a,b *int){ // b,a = a,b //}
原文地址:https://www.cnblogs.com/kisslight/p/10884969.html
时间: 2024-10-16 09:10:49