From: Clemens Valens Subject: Re: URGENT!!! Please (A Little Long) Newsgroups: comp.os.msdos.djgpp Message-ID: <004aa0e3.faebcda4@usw-ex0101-006.remarq.com> Lines: 38 Bytes: 1064 X-Originating-Host: 195.154.148.69 Organization: http://www.remarq.com: The World's Usenet/Discussions Start Here References: <3813e85f DOT 18243975 AT news DOT pasteur DOT dialix DOT com DOT au> X-Wren-Trace: eJy5kZCJzoTP38aCmNCYm52vgZCXnNCPioPdnJqFxY3Kz5LMx4jHw8TF1s/L Date: Mon, 25 Oct 1999 01:35:06 -0700 NNTP-Posting-Host: 10.0.2.6 X-Complaints-To: wrenabuse AT remarq DOT com X-Trace: WReNphoon4 940841021 10.0.2.6 (Mon, 25 Oct 1999 01:43:41 PDT) NNTP-Posting-Date: Mon, 25 Oct 1999 01:43:41 PDT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com > quick fix I have done the following. > int main(void) > { > STUDENT *Start = NULL; > > Start = AddStudent(Start); > CleanUp(Start); > > return 0; > } > STUDENT *AddStudent(STUDENT *Student) > { > STUDENT *New; > New = malloc(sizeof(STUDENT)); > /* > * etc etc. > */ > Start->Next = New; > return (Student); > } You mess horribly with pointers. And your quick fix doesn't even compile since you define Start in main() and you use it in AddStudent() as if it was a global variable, which it isn't. You call AddStudent with Student = Start = NULL. Then you create New which you assign to Start->Next, i.e. NULL->Next (gp fault) and then you return Student (which is still NULL) and assign it to Start. I won't give you the final answer, because I think it is your homework, but you should be able to figure it out now. Clemens * Sent from RemarQ http://www.remarq.com The Internet's Discussion Network * The fastest and easiest way to search and participate in Usenet - Free!