delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2004/07/14/18:30:17

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: Pedro Graca <hexkid AT hotpop DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: pointers to structs
Date: 14 Jul 2004 22:17:53 GMT
Organization: home use
Lines: 26
Message-ID: <slrncfbc8h.30m.hexkid@ID-203069.user.uni-berlin.de>
References: <1089842517 DOT 34974 AT proxy2 DOT srv DOT ualberta DOT ca>
X-Trace: news.uni-berlin.de 3I8EKHaPI5CQAasEsbyQ8AV/r1wAiA1cbAYtz3HUNU55SOzdaA
X-Location: Third rock from the Sun, Europe, Portugal, Coimbra
User-Agent: slrn/0.9.8.0 (Linux)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

[newbie answer, so it will be short]
John Hanley wrote:
(snip)
> int main()
> {
>     struct data_list * list;

list is not initialized!

>     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.

You have no idea where you're putting those NULLs to.

-- 
USENET would be a better place if everybody read:   | to email me: use |
http://www.catb.org/~esr/faqs/smart-questions.html  | my name in "To:" |
http://www.netmeister.org/news/learn2quote2.html    | header, textonly |
http://www.expita.com/nomime.html                   | no attachments.  |

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019