What should "sizeof (expression)" return? Why "8" ??
Sean Fagan
seanf at sco.COM
Thu Dec 8 07:21:50 AEST 1988
In article <654 at sbsvax.UUCP> greim at sbsvax.UUCP (Michael Greim) writes:
[struct mist { int a1:1, a2:16}; int i; float r; char s[20];
>sizeof(mist.a1) [1 bit] = 4
Because an int, on your machine, is 4 bytes long, and mist.a1 is expanded to
an unsigned int.
>sizeof(c1<c2) = 4
This is an integer expression, 4 bytes.
>sizeof(i+r) = 8
An integer and a floating point form a floating point expression, which, on
your machine, is 8 bytes.
>sizeof(i+s) = 4
This is a pointer expression (equivalent to &s[i]), and a character pointer
on your machine is 4 bytes long.
>What should "sizeof expression" return?
The size, in char's, of the expression.
--
Sean Eric Fagan | "Engineering without management is *ART*"
seanf at sco.UUCP | Jeff Johnson (jeffj at sco)
(408) 458-1422 | Any opinions expressed are my own, not my employers'.
More information about the Comp.lang.c
mailing list