X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f From: Martin Ambuhl Newsgroups: comp.os.msdos.djgpp Subject: Re: pointers to structs Date: Wed, 14 Jul 2004 19:08:48 -0400 Lines: 11 Message-ID: <2llso8Fe5t0pU3@uni-berlin.de> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de dPzZi8BR1l2kGgHFfuz6yQqzZNjQ9WtumiS1U8hpDznklVo/pj User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20040616 X-Accept-Language: en-us, en, de, fr, ru, zh, ja In-Reply-To: To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk John Bond wrote: > You need to allocate the list memory first like so: > > list = (struct data_list *) malloc(sizeof(struct data_list)); Better: list = malloc(sizeof *list); Remember to #include and to check the list after this call to make sure that malloc succeeded.