"John Bode" <> writes:
> sarma wrote:
>> int a,b,c;
>> printf ("%u %u %u \n",&a,&b,&c);
>>
>>
>> can you predict the result.
>
> The behavior is undefined, therefore the result is unpredictable.
>
> Had you written
>
> printf("%p %p %p\n", (void*) &a, (void*) &b, (void*) &c);
>
> then the behavior would no longer be undefined, but you would need to
> specify exactly which compiler and architecture were being targeted,
> since the result will vary between platforms.
Knowing the compiler would only tell you how the pointer value is
converted to a sequence of characters; it won't tell you what the
specific values are. For example, the objects a, b, and c could be
allocated in any order, and may or may not be adjacent; the
implementation is under no obligation to document this.
--
Keith Thompson (The_Other_Keith)
kst- <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.