# Include <stdio. h>
Struct line {
Int length;
Char contents [0];
};
Struct block {
Int length;
Char contents [];/* XX [] is at the end of the struct only .*/
// Int text [20];/* contexts [] can only be at the end of the struct. */
};
Int main ()
{
Struct line * thisline = (struct line *) malloc (sizeof (struct line) + 10 );
Thisline-> length = 10;
Struct block * thisblock = (struct block *) malloc (sizeof (struct block) + 10 );
Thisblock-> length = 10;
Printf ("sizeof (struct line) = % d/N", sizeof (struct line);/* print the result 4 .*/
Printf ("sizeof (struct block) = % d/N", sizeof (struct block ));
}
Bytes ---------------------------------------------------------------------------------------
Liudan @ liudan-desktop:/Media/liudan/AA/array_len_zero $
Liudan @ liudan-desktop:/Media/liudan/AA/array_len_zero $./ARR
Sizeof (struct line) = 4
Sizeof (struct block) = 4
Liudan @ liudan-desktop:/Media/liudan/AA/array_len_zero $