Objective c NSLog指针指向的地址

Objective c NSLog指针指向的地址,objective-c,Objective C,我想记录指针指向的地址。我偶然发现 然而,我仍然得到一个错误。这是我的密码 Teacher* t = [[Teacher alloc]init]; NSLog(@"t points to the address <%p>" &*t);//Error 有关于如何打印指针地址的建议吗?语法错误是由缺少逗号引起的: NSLog(@"t points to the address <%p>", &*t);

我想记录指针指向的地址。我偶然发现 然而,我仍然得到一个错误。这是我的密码

    Teacher* t = [[Teacher alloc]init];
    NSLog(@"t points to the address <%p>" &*t);//Error 

有关于如何打印指针地址的建议吗?

语法错误是由缺少逗号引起的:

NSLog(@"t points to the address <%p>", &*t);
                             --------^
您是否尝试过NSLog(@“%@”,对象,对象);这就是你所指的链接进一步建议的。不要使用“&*t”,只使用t。编译器可能需要在字符串@“t point…”和*t之间按位执行一些操作。
NSLog(@"t points to the address <%p>", &*t);
                             --------^
(@"t points to the address <%p>") & (*t) // 'NSString *' & 'Teacher'
NSLog(@"t points to the address <%p>", t);