you can USE bits, but in actual state, the memory has to be reserved in the
BYTE form. whether u use 1 bit or 8 bits, one byte will be reserved(in case
of CHAR).
if you use 1 bit of integer that'll take 2 or 4 byte if you use SHORT and
INT,respectively...
The overall concept of padding is to use memory efficiently and accessing
also becomes easy. thats why we padd the HOLES in continuous memory.



struct node
{
//char d;
int i:2;             //LINETO CHANGE NO:- 4
};
int main(){
   struct node a;
   printf("size = %d",sizeof(a));
}

ANS = 4bytes
if you change LINE NO 4:- to
char :3;
ans =1 bytes

short u :3;
ans=2 bytes





-- 
Thanks and Regards
VIKAS SINGH
MCA- final year
NIT DURGAPUR
email:
 vikas.singh1...@gmail.com
 shyguy1...@gmail.com
http://smrit.wordpress.com

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to