Give the output of the following program struct XXX {int a:6; float b:4; char s; }structure; size of (structure);

Showing Answers 1 - 6 of 6 Answers

vyom tewari

  • Aug 17th, 2005
 

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

  Was this answer useful?  Yes

nithya

  • Sep 12th, 2005
 

good questions

  Was this answer useful?  Yes

Sivaswami

  • Oct 13th, 2005
 

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;

  Was this answer useful?  Yes

avinash

  • Apr 15th, 2006
 

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

  Was this answer useful?  Yes

nams

  • Jul 3rd, 2006
 

it  gives  error

  Was this answer useful?  Yes

vikas

  • Sep 13th, 2006
 

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

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions