찾다

 >  Q&A  >  본문

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일 전424

모든 응답(1)나는 대답할 것이다

  • 伊谢尔伦

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

    으아아아 으아아아

    회신하다
    0
  • 취소회신하다