Different pointer representations on the same machine

Charlie Goldensher charlie at vicorp.UUCP
Fri Feb 24 05:35:57 AEST 1989


In article <9382 at bloom-beacon.MIT.EDU>, scs at adam.pika.mit.edu (Steve Summit) writes:
> In article <2310 at scolex.sco.COM> seanf at scolex.UUCP (Sean Fagan) writes:
> >when you print out a pointer... do you typecast it to long and
> >use a %ld format?
> 
> No, I just use %p.

That's fine if you don't expect to port the code to another machine.
But be aware that not all versions of printf provide the %p option.
I typecast the pointer to a long and use 0x%lx.  (I find the hex
notation more useful for pointers than the decimal notation.)



More information about the Comp.lang.c mailing list