Re: writing to freed memory--issues



Kasper Dupont <31026663590054698937@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> writes:

"Chris F.A. Johnson" wrote:

To get leading zeros:

printf("%010p\n",main); /* 10 places to allow for 0x */

This result in a compiler warning, but it seems to work.

Still doesn't do what I want: it prints a null pointer as (nil). I
use 0x%08x to print pointers, so it always comes out as an eight digit
hex number, with a leading 0x to tell the reader it's hexadecimal.

Yes, when I move on to 64 bits some day it's going to break...
--
Joseph J. Pfeiffer, Jr., Ph.D. Phone -- (505) 646-1605
Department of Computer Science FAX -- (505) 646-1002
New Mexico State University http://www.cs.nmsu.edu/~pfeiffer
.