Indefinite-length array as member of struct: how?

David Olix dwho at nmtsun.nmt.edu
Sat Jul 8 05:45:11 AEST 1989


>regarding variable-length strings...
>
>struct node {
>	struct node* next;
>	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;'?



More information about the Comp.lang.c mailing list