GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Placement Papers  >  Intel  >  Programming
Go To First  |  Previous Question  |  Next Question 
 Programming  |  Question 7 of 9    Print  

How much memory will be allocated to this union:

union a

{

char b;

int no:2; (bit field)

}


  
Total Answers and Comments: 3 Last Update: January 21, 2006   
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
September 12, 2005 18:52:37   #1  
non-name        

RE: How much memory will be allocated to this union...
3 bit
 
Is this answer useful? Yes | No
December 19, 2005 07:02:57   #2  
asadullah ansari        

RE: How much memory will be allocated to this union...

Size of a union is the size of one of the data types which resides in union whose is the largest between them so it's size is ONE BYTE.


 
Is this answer useful? Yes | No
January 21, 2006 04:42:38   #3  
bndeshmukh1 Member Since: January 2006   Contribution: 1    

RE: How much memory will be allocated to this union...
hi size of a union is size of largest data type among its members ...so size of union a is 4 bytes.Even if int no is type bt-field the sizeof union will remain 4 bytes as sizeof(int) 4.now int no:2 means value for no wil be 2-bit wide i.e. either 00->0 01->1 10->2 or 11->3 that is all--bhalchandra
 
Is this answer useful? Yes | No


 
Go To Top


 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