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

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: "John Hanley" <jdhanley AT telusplanet DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: pointers to structs
Date: Wed, 14 Jul 2004 16:03:09 -0600
Organization: University of Alberta
Lines: 35
Message-ID: <1089842517.34974@proxy2.srv.ualberta.ca>
NNTP-Posting-Host: proxy2.srv.ualberta.ca
X-Trace: tabloid.srv.ualberta.ca 1089842518 1429 129.128.5.161 (14 Jul 2004 22:01:58 GMT)
X-Complaints-To: abuse AT ualberta DOT ca
NNTP-Posting-Date: Wed, 14 Jul 2004 22:01:58 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4522.1200
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200
Cache-Post-Path: proxy2.srv.ualberta.ca!unknown AT d198-166-28-25 DOT abhsia DOT telus DOT net
X-Cache: nntpcache 3.0.1 (see http://www.nntpcache.org/)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I am creating a linked list.  I have 2 structs:

struct data_record
{
    struct data_record * next;
};

struct data_list
{
    struct data_record * head;
    struct data_record * tail;
};

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



- Raw text -


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