thank u.
On Wed, Feb 29, 2012 at 6:36 PM, Gene gene.ress...@gmail.com wrote:
Draw a picture!
char goes at 0 because it can go anywhere
short goes at 2 because it must be on a 2-byte boundary; it consumes
bytes 2 and 3
char goes at 4 because this is the next byte after the short;
This depends on the compiler and even on the options you give the
compiler. The C nor C++ standards don't say.
So the asker of the question hasn't give you enough information.
If you assume 32-bit x86 gcc with no packing options or pragmas, I
think shorts (which are 2 bytes long) are aligned on
http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-087-practical-programming-in-c-january-iap-2010/lecture-notes/MIT6_087IAP10_lec06.pdf
On 2/29/12, Gene gene.ress...@gmail.com wrote:
This depends on the compiler and even on the options you give the
compiler. The C nor
how in the second case it is 12?can u tell the clear expl..
On Wed, Feb 29, 2012 at 8:39 AM, Gene gene.ress...@gmail.com wrote:
This depends on the compiler and even on the options you give the
compiler. The C nor C++ standards don't say.
So the asker of the question hasn't give
Draw a picture!
char goes at 0 because it can go anywhere
short goes at 2 because it must be on a 2-byte boundary; it consumes
bytes 2 and 3
char goes at 4 because this is the next byte after the short; it
consumes byte 4; byte 5 is the next byte free
long goes at 8 because this is the next