On Tue, 16 May 2006 10:17:02 +0000, Richard Heathfield
<in*****@invalid.invalid> wrote:
sk*******@yahoo.co.in said:
If i declared extern int x; in linux environment. what is the size?
No storage is reserved, so there isn't a size.
One may interpret the OP's question as: "What is sizeof x?" In which
case, the following code should answer that question.
#include <limits.h>
#include <stdio.h>
extern int x;
int main(void)
{
const int INT_BITS = (int)(sizeof(int) * CHAR_BIT);
printf
(
"sizeof x = %d, same as sizeof(int) = %d\n",
(int)sizeof x,
(int)sizeof(int)
);
printf
(
"type int is %d bit%s\n",
INT_BITS,
INT_BITS == 1 ? "" : "s"
);
return 0;
}
int x = 0;
If you can spot how a standard-compliant compiler will never achieve
100% decision coverage in the above code, then you win a prize.
--
jay