arrays in structures

utzoo!decvax!ucbvax!unix-wizards utzoo!decvax!ucbvax!unix-wizards
Sun Dec 27 16:33:25 AEST 1981


>From alice!ark at Berkeley Sun Dec 27 16:20:40 1981
They are legal, and if they don't work then you must have a buggy compiler.
Example:  I should be able to say:

	struct {
		int a;
		char b[25];
		int c;
	} foo[30];

This allocates space for 30 instances of a structure containing an
int, 25 chars, some padding (1 byte on a PDP-11, 3 bytes on a VAX),
and another int.  I can refer to things like:

	foo[15].a
	foo[x].b[y]

and so on.  I know of no particular bugs that would cause trouble here.



More information about the Comp.unix.wizards mailing list