logo
  • 教程列表
  • SO官方文档
  • 指针
    • 基本指针
    • 指针诉价值方法
    • 取消引用指针
    • 切片是指向数组段的指针
    • 简单的指针
  1. StackOverflow 文档
  2. Go 教程
  3. 指针
  4. 简单的指针

简单的指针

Created: November-22, 2018

func swap(x, y *int) {
  *x, *y = *y, *x
}

func main() {
  x := int(1)
  y := int(2)
  // variable addresses
  swap(&x, &y)
  fmt.Println(x, y)
}
  • 切片是指向数组段的指针

Copyright © 2018. All right reserved

tastones.com 备案号:鲁ICP备18045372号-1

  • 关于我们
  • 免责声明