我在 Mac OSX Lion 上使用 C++,并创建了以下代码:
float* floatArray = new float[10];
for(int i = 0; i < 10; i++)
{
floatArray[i] = 0.0 ;
}
std::cout<< "Test size of a float " << sizeof(floatArray[0]) << std::endl;
// The value is 4 byte which is what I would expect.
std::cout<< "Test the size of the whole array" << sizeof(floatArray) <<std::endl;
// the value is 8. I would have expected the value to be 40 bytes.
我不明白什么?
提前致谢