www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript

c++ - Variable sizes

↑ ↓ ← 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
→ 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
→ 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