如何打印出变量的内存地址? [英] How can I print out the Memory Address of a variable?
本文介绍了如何打印出变量的内存地址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想打印 &myVariable 后面的内容.我试过 NSLog(&myIntVar);但它不起作用.
I'd like to print what's behind an &myVariable. I tried NSLog(&myIntVar); but it won't work.
推荐答案
NSLog 的参数需要是一个 NSString,所以你要
The argument to NSLog needs to be an NSString, so you want
NSLog(@"%p", &myIntVar);
这篇关于如何打印出变量的内存地址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文