On 12/10/2012 8:24 AM, Prathamesh Kulkarni wrote:
> consider,
> char *p; float a;
> p = (char *) &a;
>
> So n1570 6.3.2.3 7th point
> states what address p would point to
> after the assignment p = (char *) &a ?
Yes: `p' will point at "the lowest addressed byte" of `a'.
The bytes that make up the representation of `a' are `p[0]',
`p[1]',...,`p[sizeof(float)-1]'.
Deciding what each of those bytes means is trickier. Each
implementation defines its own representations for the various
C data types, and they don't all use the same encoding. If you
set `a = 3.14f;' and then print `*p' on different machines, you
may well get different outputs.
> I am sorry for asking dumb questions,
> have never looked through the standard
> before.
A question isn't dumb until it's asked twice.
--
Eric Sosman
d