// zerolenArray.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
struct truA
{
};
struct truB
{
int a[0];
};
int main(int argc, char* argv[])
{
//零长度的byte数组
printf("sizeof(struct truA)=%d\n",sizeof(struct truA));
printf("sizeof(struct truB)=%d\n",sizeof(struct truB));
return 0;
}
/*
zerolenArray.cpp
zerolenArray.cpp(12) : warning C4200: nonstandard extension used : zero-sized array in struct/union
Linking...
zerolenArray.exe - 0 error(s), 1 warning(s)
sizeof(struct truA)=1
sizeof(struct truB)=1
Press any key to continue
*/
零长度的数组
最新推荐文章于 2024-05-01 17:03:26 发布