快速问题:如何调试对象-C中const float *类型的常量中的值?
该对象在.h文件中声明如下:
const float *vertices;尝试了%d (整数)、%@、%f (双),但警告提示:
%@ , Format specifies type 'id' but the argument has type 'const float *'
%d , Format specifies type 'int' but the argument has type 'const float *'
%f , Format specifies type 'double' but the argument has type 'const float *'发布于 2013-11-27 09:03:45
您的意思是要打印它的值吗?
NSLog(@"%p: %f", vertices, * vertices);这将在地址中打印其地址和浮动值。
正如@KenThomases建议的那样,如果不能保证,您可能需要检查vertices is NULL。并打印出vertices中的所有值
NSUInteger length = // length of vertices
for (NSUInteger i = 0; i < length; ++i) {
NSLog(@"%f", vertices[i]);
}https://stackoverflow.com/questions/20237860
复制相似问题