www.digitalmars.com         C & C++   DMDScript  

c++ - Variable sizes

reply IR <IR_member pathlink.com> writes:
With the Digital Mars compiler, how big (in bytes) are these variables?

unsigned int, int, unsigned short, short, unsigned long, long, and char

Thanks
Oct 03 2004
next sibling parent Heinz Saathoff <hsaat despammed.com> writes:
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
Oct 04 2004
prev sibling parent Scott Michel <scottm aero.org> writes:
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; }
Oct 04 2004