www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/11/13/11:54:57

From: kagel AT quasar DOT bloomberg DOT com
Date: Wed, 13 Nov 1996 11:31:21 -0500
Message-Id: <9611131631.AA04157@quasar.bloomberg.com >
To: owsim AT ruc DOT dk
Cc: djgpp AT delorie DOT com
In-Reply-To: <9611131456.AA13732@emma.ruc.dk> (owsim@ruc.dk)
Subject: Re: How assign to NULL POINTER
Reply-To: kagel AT dg1 DOT bloomberg DOT com

   Errors-To: postmaster AT bloomberg DOT com
   From: owsim AT ruc DOT dk (Ole Winther)
   Date: Wed, 13 Nov 1996 15:56:22 +0100 (MET)
   X-Mailer: ELM [version 2.4 PL21]
   Mime-Version: 1.0
   Content-Transfer-Encoding: 8bit
   Content-Type: text/plain; charset=ISO-8859-1
   Content-Length: 462

   I where asking about course of "segment violation at pointer " error, while
   running a gcc compiled program. I got the answer that it probaly is a Null
   pointer assignment and I must belive it'sw true, course the "BC" compiled
   program which where running the same code, was also complaining about the
   Null pointer assignment while program end was ended. 

   I really dont know how I can assign value's to the NULL pointer, can someone
   describe how this can be done?

No no no.  The problem is that you have dereferenced a null pointer and
assigned a value to the location to which you think that it is pointing.  

A null pointer is a pointer which has not been initialized to an address nor
assigned an address to which to point.  It therefore contains a value of zero,
or null, and points nowhere.  You must find the null pointer and either assign
the address of the correct data item or malloc() some memory to which it can
point.  Run you program under GDB until it crashes and then poke around the
code in GDB to locate the uninitialized pointer variable and repair your code.

-- 
Art S. Kagel, kagel AT quasar DOT bloomberg DOT com

A proverb is no proverb to you 'till life has illustrated it.  -- John Keats

- Raw text -


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