Total members 11895 |It is currently Wed Dec 18, 2024 2:46 am Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





Quote:
Assuming 32 bit compiler, Unsigned int will take 4 bytes

Code:
Struct mystruct
{
   unsigned int bit0 : 1;
   unsigned int bit0 : 1;
   unsigned int bit0 : 1;
   unsigned int bit0 : 1;
   unsigned int bit0 : 1;
   unsigned int bit0 : 1;
   unsigned int bit0 : 1;
   unsigned int bit0 : 1;
}a;

I have the doubt,whether the sizeof structure is 1 byte or 4 byte?
Is sizeof(a)=1 or sizeof(a)=4?





Author:
Newbie
User avatar Posts: 4
Have thanks: 0 time

its 8 that means that its 4 bytes


Author:
Moderator
User avatar Posts: 47
Have thanks: 1 time

biskot188 wrote:
its 8 that means that its 4 bytes

Quote:
I have compiled the progrma and printed the sizeof(a).It is 1 byte.Not 4 bytes. Why is this so..



Author:
Newbie
User avatar Posts: 4
Have thanks: 0 time
Post new topic Reply to topic  [ 3 posts ] 

  Related Posts  to : What is the size of this Structure
 Set image size as a percentage of the page size     -  
 c++/data structure     -  
 ASP file structure     -  
 Display data from database as Tree Structure in JSP     -  
 program using structure to store roll number,name     -  
 Array size to zero     -  
 get string size in c++     -  
 Nav button size     -  
 preferred size of a component     -  
 get Folder path and size     -  



cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com