Date: Wed, 13 Nov 1996 17:52:46 +0200 (IST) From: Eli Zaretskii To: Ole Winther Cc: djgpp AT delorie DOT com Subject: Re: How assign to NULL POINTER In-Reply-To: <9611131456.AA13732@emma.ruc.dk> Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Wed, 13 Nov 1996, Ole Winther wrote: > I really dont know how I can assign value's to the NULL pointer, can someone > describe how this can be done? The most frequent case is when you declare a pointer which is a global variable (and is therefore initialized to zero even if you didn't give it any value), then use it before assigning any value to it. Example: char *ptr; /* will be initialized to zero by the linker */ void myfunc(void) { char c = *ptr; /* this will crash your program under DJGPP */ } The simplest way to catch these errors is to run your program until it crashes, then run symify. It will add filenames and source line numbers to the stack dump. You should then run your program under a debugger, put a breakpoint at the line which crashed (this is the uppermost of the lines printed by `symify') and when that breakpoint is hit, examine the pointers which that line is using to look for the pointer(s) which have zero or garbled values.