The size of a structure is determines by the Product of sizes of all primitive data types within the structure?

Skill/Topic: Variables and Pointers
A) True
B) False
Explanation: The size of a structure is the sum of the sizes of all the primitive data types within the structure

Showing Answers 1 - 8 of 8 Answers

viky_tyc

  • Mar 17th, 2006
 

Even this will not be true always. Because of the memory alignment, eventually size of a structure would be >= the sum of sizes of individual structure members.

Chantigd

  • Jan 1st, 2007
 

There is concept called as "Padding" which is completely Operating system dependend.ex:struct a{ int a; int b; char c; int d;}Answer : 2 + 2 + 1 + 2 (bytes) = 7Bytes (not correct always) can be 8bytes since the allocation is done in "word" size which is 2bytes [generally -> depends on O/s and processor]

  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