Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > number of bytes for a type in C++

Reply
Thread Tools

number of bytes for a type in C++

 
 
Carl Muller
Guest
Posts: n/a
 
      12-12-2004
>In C++, the amount of memory used to store int is 4 bytes,
>or dependent upon the hardware?


On the compiler/cpu I use, int uses 1 byte, but the byte has 16 bits
so it can hold a value between -32768 and 32767.
So sizeof(char) == sizeof(short) == sizeof(int) == 1 which is 16 bits,
but sizeof(long) == 2 which is 32 bits.

This is valid (but not common) for both the C and C++ standards.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Ratio of Bytes Delayed to Bytes Sent netproj Cisco 0 12-21-2005 08:08 PM
number of bytes for a type in C++ Carl Muller C Programming 3 12-13-2004 11:52 PM
number of bytes for a type in C++ jrefactors@hotmail.com C++ 6 12-10-2004 08:55 PM
number of bytes for a type in C++ jrefactors@hotmail.com C Programming 5 12-10-2004 08:42 PM
Private Bytes vs. # Bytes in all Heaps in Perfmon Jason Collins ASP .Net 3 02-18-2004 03:59 PM



Advertisments