X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f Message-ID: <40F92C1B.7090706@012.net.il> Date: Sat, 17 Jul 2004 15:39:39 +0200 From: alexbodn User-Agent: Mozilla/5.0 (Windows; U; Win98; he-IL; rv:1.6) Gecko/20040113 X-Accept-Language: en-us, en, he MIME-Version: 1.0 To: djgpp AT delorie DOT com Subject: Re: pointers to structs References: <1089842517 DOT 34974 AT proxy2 DOT srv DOT ualberta DOT ca> In-Reply-To: <1089842517.34974@proxy2.srv.ualberta.ca> Content-Type: text/plain; charset=ISO-8859-8-I; format=flowed Content-Transfer-Encoding: 8bit Reply-To: djgpp AT delorie DOT com hi john, the problem in your program is, that you are trying to initialize the struct list pointed at by a random pointer. the pointer list should point to a valid structure, obtained through malloc or normal struct list variable instantiation. for example, struct list *plist = malloc(sizeof(struct list)), or {struct list list; struct list *plist = &list} best regards, alex φιθεθ John Hanley: >int main() >{ > struct data_list * list; > > list->head = NULL; > list->tail = NULL; >} > >When I compile then run this, I get: "Exiting due to Signal SIGSEGV. Page >Fault at ..." > >Can I not assign NULL to these pointers? If I take the 2 assignments out, >it runs ok. > >Any suggestions as to why I can't initialize my head and tail to NULL? > >Thanks! > >John > > > > > >