Newsgroups: comp.lang.c Path: utzoo!telly!druid!darcy From: darcy@druid.uucp (D'Arcy J.M. Cain) Subject: Re: Null Pointer Assignment Organization: D'Arcy Cain Consulting, West Hill, Ontario Date: Sat, 13 Oct 90 13:53:03 GMT Message-ID: <1990Oct13.135303.21311@druid.uucp> References: <15004@mentor.cc.purdue.edu> <27154927-274.1comp.lang.c-1@tronsbox.xei.com> In <27154927-274.1comp.lang.c-1@tronsbox.xei.com> Bill Cavanaugh writes: >>not come up until the end of the program. In fact, I put in the line >> >>printf("done\n"); >>exit(0); >> >>at the end of my main, and when executed, it says >> >>done >>Null Pointer Assignment >> >>Does this make sense? Thanks for any suggestions. >> >I'm not sure about the message, so I won't comment on that, but the reason >the message is coming up after the printf() is that the printf() sends it's >output to stdout, and the message is going to stderr.... > Wrong. The Null Pointer Assignment message is generated *AFTER* main returns. The C startup code looks at the copyright message at address 0 to see if it was modified anytime during the run. This is necessary on DOS systems as there is no memory protection to generate an exception. This check at the end of the program is designed to give some indication that a NULL pointer was dereferenced. The error however could have happened anywhere in the program. To find it you have to use your debugger to follow the values at DS:0 or set a watch up for that memory location. Check your debugger documentation for details. -- D'Arcy J.M. Cain (darcy@druid) | D'Arcy Cain Consulting | I support gun control. West Hill, Ontario, Canada | Let's start with the government! + 416 281 6094 |