搜尋

首頁  >  問答  >  主體

ios - swift 打印地址的问题

func test(_ arr: [String]) {
    
    for var i in arr {
        withUnsafePointer(to: &i) {
            print(" str value \(i) has address: \($0)")
        }
    }
}

var a = ["1","2","3"]

test(a)

打印结果:
str value 1 has address: 0x00007fff5dff9fc0
str value 2 has address: 0x00007fff5dff9fc0
str value 3 has address: 0x00007fff5dff9fc0

如果我想打印整个数组的地址怎么打?

如果数组里不是字符串,是其他类型,改怎么打?找了很久没找到,特此来提问

怪我咯怪我咯2771 天前420

全部回覆(1)我來回復

  • 伊谢尔伦

    伊谢尔伦2017-04-18 09:53:11

    雷雷 雷雷

    回覆
    0
  • 取消回覆