Path: utzoo!attcan!uunet!munnari.oz.au!brolga!bunyip.cc.uq.oz.au!zeus!s64421 From: s64421@zeus.usq.EDU.AU (house ron) Newsgroups: comp.lang.c Subject: Re: TC 2.0 oddity - me or it ? Message-ID: Date: 13 Nov 90 09:50:04 GMT References: <7131@castle.ed.ac.uk> Lines: 27 djm@castle.ed.ac.uk (D Murphy) writes: >I have a program running on a PC which does its job perfectly BUT which >produces a Null pointer assignment message after it has finished. This >is being caused by something after the last instruction (I tested this >by adding puts("Last"); just before the closing brace of main() and got >Last >Null pointer assignment Zero is actually a perfectly legitimate address, but it got snaffued by C to stand for a NULL pointer. Thus, if in your program you do: int *p = NULL; *p=9; You will happily store 9 in address zero. The compiler doesn't write logic to check for this because it would slow you down. But when the prog. finishes, it does just a single check on address zero to see if you changed it. You should be able to easily write a small test prog. to verify this. -- Regards, Ron House. (s64421@zeus.usq.edu.au) (By post: Info Tech, U.C.S.Q. Toowoomba. Australia. 4350)