Thread overview | |||||
---|---|---|---|---|---|
|
October 03, 2004 Variable sizes | ||||
---|---|---|---|---|
| ||||
With the Digital Mars compiler, how big (in bytes) are these variables? unsigned int, int, unsigned short, short, unsigned long, long, and char Thanks |
October 04, 2004 Re: Variable sizes | ||||
---|---|---|---|---|
| ||||
Posted in reply to IR | Hello,
IR wrote...
> With the Digital Mars compiler, how big (in bytes) are these variables?
>
> unsigned int, int, unsigned short, short, unsigned long, long, and char
depends on the memory model. In standard 32-bit windows the sizes are:
unsigned int and int : 32 bit
unsigned short and short : 16 bit
unsigned long and long : 32 bit
unsigned char and char : 8 bit
HTH,
Heinz
|
October 04, 2004 Re: Variable sizes | ||||
---|---|---|---|---|
| ||||
Posted in reply to IR | IR wrote:
> With the Digital Mars compiler, how big (in bytes) are these variables?
>
> unsigned int, int, unsigned short, short, unsigned long, long, and char
>
> Thanks
int main(void)
{
printf("sizeof(unsigned int) = %d\n", sizeof(unsigned int));
printf("sizeof(int) = %d\n", sizeof(int));
printf("sizeof(unsigned short) = %d\n", sizeof(unsigned short));
printf("sizeof(short) = %d\n", sizeof(short));
printf("sizeof(unsigned long) = %d\n", sizeof(unsigned long));
printf("sizeof(long) = %d\n", sizeof(long));
printf("sizeof(char) = %d\n", sizeof(char));
return 0;
}
|
Copyright © 1999-2021 by the D Language Foundation