C++ 从XCode调试控制台打印C数组索引内容

C++ 从XCode调试控制台打印C数组索引内容,c++,objective-c,c,audio,buffer,C++,Objective C,C,Audio,Buffer,我正在寻找一种将C样式数组索引的内容打印到XCode 4.5中的控制台窗口的方法。换句话说,当我的音频缓冲区(一个C数组)被浮点数据填充时,我会在填充后放置一个断点,我只想打印数组[]中内容的值。我尝试了以下方法: // Just an example of what I'm doing. The following is a buffer that I am declaring: int total = 235377; float tmpArr[total]; // gives me the

我正在寻找一种将C样式数组索引的内容打印到XCode 4.5中的控制台窗口的方法。换句话说,当我的音频缓冲区(一个C数组)被浮点数据填充时,我会在填充后放置一个断点,我只想打印数组[]中内容的值。我尝试了以下方法:

// Just an example of what I'm doing. The following is a buffer that I am declaring:
int total = 235377;
float tmpArr[total];

// gives me the first index [0] contents value only when I type this in the console window in Xcode
p tmpArr

// gives the following error:
// error: subscripted value is not an array, pointer, or vector
// error: 1 errors parsing expression
p tmpArr[3]

// gives me the address as expected
p &tmpArr

// the following seems to access contents but is casting them to ints and therefore truncating anything after the decimal...in audio programming, the float data is between 0 and 1 sooo....
frame variable -ffloat tmpArr
frame variable -ffloat tmpArr[3]
我试图找到我为什么不能访问数组索引内容的答案。我是不是遗漏了什么?每次要调试时,是否必须将printf()放在for循环中?谢谢

更新


正如@Daniel Fischer指出的,在XCode控制台中键入p*(tmpArr+indexNumber)成功访问tmpArr[indexNumber]并将其打印到调试控制台。

您是否尝试过
p*(tmpArr+3)
?您确定这就是您声明数组的方式吗?听起来更像是您在调试器消息中键入了“float tmpArr(total)”。@DanielFischer就是这样做的!谢谢你的指点(字面意思是…)