mufasa wrote:
printf("\n%u\n",&temp);
Undefined behavior. %u is not compatible with pointers. Use %p to
print pointers. You were lucky here.
How exactly is the memory allocated to the datatypes? In what order? Is
it a question worth asking?
You can't rely on any ordering between different objects. The only
thing you can guarantee is that pointers to elements of the same
array (or one past the end) compare such as if the earlier elements
had smaller values. There's actually no indication that the addresses
are smaller. Machines such as the Cray which are word addressed
actually encoded the byte offset in the word for char* in the high
bits so sequential locations would actually be (for an array starting
at 0x1000):
0x0000000000001000
0x1000000000001000
0x2000000000001000
....