我不理解带有数组的sizeof()给出的值

Jas*_*son 1 c++ arrays sizeof

在这个代码片段中,我得到的输出是24.为什么?

int data[] = { 5, 6, 7, 1, 4, 0 };

int n = sizeof(data);

cout << n << endl;
Run Code Online (Sandbox Code Playgroud)

ipa*_*lic 8

sizeof 返回24因为你有6个整数,每个整数占4个字节.