GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Placement Papers  >  Sun  >  Technical
Go To First  |  Previous Question  |  Next Question 
 Technical  |  Question 2 of 25    Print  
Give the output of the following program
struct XXX
{int a:6;
float b:4;
char s;
}structure;
size of (structure);


  
Total Answers and Comments: 6 Last Update: September 13, 2006   
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
August 17, 2005 07:40:04   #1  
vyom tewari        

RE: Give the output of the following program struct XXX {int a:6; float b:4; char s; }structure; size o...
size of structure is 12 byte this is because compiler use optimization so at 32 bit machine compiler use word size to represent data so in this case it allocate 4 byte for character so it size is 4+4+4 12 byte
 
Is this answer useful? Yes | No
September 12, 2005 05:06:22   #2  
nithya        

RE: good
good questions
 
Is this answer useful? Yes | No
October 13, 2005 23:43:33   #3  
Sivaswami        

RE: Give the output of the following program
struct XXX
{int a:6;
float b:4;
char s

Can a Bitfield have float as its data type ? I think the answer is error for this.struct XXX{int a:6;float b:4;char s;}structure;
 
Is this answer useful? Yes | No
April 15, 2006 05:37:43   #4  
avinash        

RE: Give the output of the following programstr...

there is an error bit fields must have integral type!! and if u change float to int it will give 3


 
Is this answer useful? Yes | No
July 03, 2006 04:03:55   #5  
nams        

RE: Give the output of the following programstr...
it gives error
 
Is this answer useful? Yes | No
September 13, 2006 03:09:23   #6  
vikas        

RE: Give the output of the following programstr...
it ll give error because the bit field desginated for b is not integral multiple of field width of float... if b is changed to int.. then answer is 3
 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape