Size of structure containing char fields

Bruce Szablak bds at lzaz.ATT.COM
Wed Jul 18 00:29:50 AEST 1990


Given a structure that contains only char fields (possibly unsigned):

	struct example1 { char a, b, c; };

is ANSI restrictive enough [;-)] to force sizeof(example1) to be 3?

Is anyone aware of existing compilers for which this wouldn't be true?

Is there a portability problem with the following structure where the
array is intended to support a variable length array?

	struct example2 { char a, b, c[1]; };

Thanks in advance.



More information about the Comp.lang.c mailing list