TITLE: Size of zero element arrays PROBLEM: viren@wipro.wipsys.soft.net (Virendra Kumar Mehta) Just out of curiousity, what is the sizeof() a zero length array? A couple quick test programs I wrote tells me that typedef struct {char i[0];} ZZZ; main() {printf("%d\n",sizeof(ZZZ));} the above had a size of 1 if I compile with a .cc extention (c++); but size of 0 if I compile with a .c extention (c). RESPONSE: jimad@microsoft.com (Jim Adcock), Microsoft Corporation, 1 Mar 94 ARM says you cannot statically define arrays of #elements == 0, however you are allowed to dynamically allocate arrays of #elements == 0, so the static constraint makes no sense, IMHO. In any case, the sizeof an array = #elements * sizeof(element) "by definition" since the sizeof(anything) is "by definition" the number of bytes that thing takes *as an element in an array*. Thus the sizeof() a zero length array by definition must be zero. This is not the same as saying the number of bytes taken by a zero length dynamic allocation is zero. On the contrary, it is very common for such to take on the order of 10 bytes of storage space "wasted".