You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
160 B
Go
16 lines
160 B
Go
4 years ago
|
package numerical
|
||
|
|
||
|
import "fmt"
|
||
|
|
||
|
func swap(x, y *int) {
|
||
|
*x, *y = *y, *x
|
||
|
}
|
||
|
|
||
|
func main() {
|
||
|
x := 3
|
||
|
y := 2
|
||
|
fmt.Println(x, y)
|
||
|
swap(&x, &y)
|
||
|
fmt.Println(x, y)
|
||
|
}
|