--- guru_bo <[EMAIL PROTECTED]> wrote:

> 
> 
> Question is 
> #include<stdio.h>
> #include<conio.h>
> 
> void main()
> {
> 
>     struct BIT
>     {
>       int op1:5, op2:12;
>         char d1;
>         int reg;
>     }Bitfields;
> 
>     clrscr();
> 
> printf("%d is the size of the
> structure",sizeof(Bitfields));
> 
> }
> 
> What is the output
> 
> Ans is 6,
> My reasoning is 
> 
> Assuming int is 2 byte
> 
> op1:5          -      1, nearest byte is 5 + 3 ..
> 1byte
> op2:12         -      2 bytes
> char d1        -      1 byte
> int reg        -      1 byte //IT should be 2
> 
> is it correct     
> Guru  
> 
> 

Its the sum 12+5 = 17 bits + 7 bits = 24 bits (3
bytes)

op1 + op2  =  3 bytes
char  = 1 byte
int  = 2 byte


The answer would be 6 bytes..

Rgds,
Ashwin 




        
                
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - You care about security. So do we. 
http://promotions.yahoo.com/new_mail





------------------------ Yahoo! Groups Sponsor --------------------~--> 
$4.98 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/Q7_YsB/neXJAA/yQLSAA/EbFolB/TM
--------------------------------------------------------------------~-> 

To unsubscribe : [EMAIL PROTECTED]

 
Yahoo! Groups Links

<*> To reply to this message, go to:
    
http://groups.yahoo.com/group/Programmers-Town/post?act=reply&messageNum=4925
    Please do not reply to this message via email. More information here:
    http://help.yahoo.com/help/us/groups/messages/messages-23.html

<*> To visit your group on the web, go to:  
    http://groups.yahoo.com/group/Programmers-Town/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to