Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!gatech!uflorida!haven!decuac!c3pe!charles From: charles@c3pe.UUCP (Charles Green) Newsgroups: comp.lang.c Subject: Indefinite-length array as member of struct: how? Keywords: char string [] [0] [1] Message-ID: <7360@c3pe.UUCP> Date: 6 Jul 89 16:20:17 GMT Organization: C3 Inc, Herndon, VA Lines: 24 I have an application where I'm building and manipulating a stack of variable-length strings. I've set up a linked list of nodes, each one declared as follows: struct node { struct node* next; char string[]; } *nodeptr; When I know how long the string is I'm pushing onto the stack, I say: nodeptr = malloc(strlen(data)+5); to cover the struct node* and terminating NULL, and then simply strcpy(nodeptr->string, data); The only problem I have is with compilation: I get a warning about the zero-length element "string". I'd like to find out the "correct" way to do this. I'll be glad to summarize any Emailed responses, of course. Thanks, Charles Green charles%c3pe@decuac.dec.COM -- {decuac.dec.com,cucstud,sundc}!c3pe!charles ex::!echo Boo: