Path: utzoo!attcan!uunet!husc6!rutgers!att!whuts!homxb!hound!rkl1 From: rkl1@hound.UUCP (K.LAUX) Newsgroups: comp.lang.c Subject: Re: Dynamically malloc()-able pointers in a struct? Message-ID: <2831@hound.UUCP> Date: 26 Dec 88 14:12:46 GMT References: <448@blake.acs.washington.edu> Distribution: na Organization: AT&T Bell Laboratories, Holmdel Lines: 27 In article <448@blake.acs.washington.edu>, phaedra@blake.acs.washington.edu (J. Anderson) writes: > > I have a small C syntax problem. Given I have a structure of > with the following nature: > > struct xyzzy { > int plugh; > long black_rod; > char *foobar; /* This wants to be a pointer to a variable-length > * array > */ > } > Try: #include /* or whatever include file your system has */ struct xyzzy s; s.foobar = (char *) malloc (nbytes); if (s.foobar == NULL) { /* don't forget to test for failure */ /* Error */ } --rkl