Mie*_*iek 1 c++ arrays macos sizeof
我在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.
Run Code Online (Sandbox Code Playgroud)
我不明白的是什么?
提前致谢
| 归档时间: |
|
| 查看次数: |
179 次 |
| 最近记录: |