Reply to: char arrays

utzoo!decvax!ucbvax!unix-wizards utzoo!decvax!ucbvax!unix-wizards
Sun Dec 27 13:07:56 AEST 1981


>From gwyn at UTEXAS-11 Sun Dec 27 12:53:53 1981
struct	{
	char	foo[25];
	int	bar;
	}	array[10];
on a PDP-11 (for example) reserves (25+1+2)*10 bytes of storage.  The +1
is required to perform word alignment (not necessary on VAX).  I don't
know why your bug happened; most likely are (1) coding error or (2)
compiler bug.
Incidentally,
typedef	char	foo[3];
really does make "foo" a 3-byte long data type (amazing!).
-------



More information about the Comp.unix.wizards mailing list