Indefinite-length array as member of struct: how?

Henry Spencer henry at utzoo.uucp
Sun Jul 9 14:27:14 AEST 1989


In article <2831 at nmtsun.nmt.edu> dwho at nmtsun.nmt.edu (David Olix) writes:
>>	char	string[];
>>} *nodeptr;
>>
>>If you want to shut your compiler up, try making that "[1]".
>
>I guess I am unclear on something here.  If you define string as
>'char string[1];', that only gives you one char's worth of space in string.
>If that's the case why don't you define string as 'char string;'?

Because then nodeptr->string gives you a value of type char, not char *.
It's a convenience issue.
-- 
$10 million equals 18 PM       |     Henry Spencer at U of Toronto Zoology
(Pentagon-Minutes). -Tom Neff  | uunet!attcan!utzoo!henry henry at zoo.toronto.edu



More information about the Comp.lang.c mailing list