a simple question about pointers

This is a discussion on a simple question about pointers within the C Programming forums, part of the General Programming Boards category; Hi, I am a freshman computer engineering student and I've just started programming in C, it may seem a bit ...

The negative numbers are because, techncially anything with the highest bit set which means for 32-bit numbers above decimally 2 billion and a bit is a negative number in computers. If you do not want "large" numbers to appear negative, then you should use %u instead of %d - %u stands for "unsigned", which means "do not treat the highest bit as sign" - then you get a number in the 3 billion range.

They do not behave differently in any other way than the actual representation of the value in the output. If you treat a memory address as a signed decimal number, and the value is above 2^31, then it will show as a negative number (and 0xbfffxxxx is about 1 billion/1GB into the negative region). If you use %x, it will look similar to your %p format - the difference here is that %p knows about the size of a pointer, and %x will show "an integer size" value (unless you specify %lx or %llx for long and long long values respectively - and one of these three options is MOST LIKELY right for a pointer, but the trick is to know which - %p knows that - it would even know architectures that have strange pointers and represent that in a sensible manner).