How much is size of struct having 1 char & 1 integer?

Answer Posted / vadivelt

The size of the stucture depends on the following factors.

1.Depends on the size of the datatype, allocated by compiler
2.Depends on the allignment of the variables in the
structure.

If variables of different datatypes are misalligned, then
badding bytes will be added by the compiler to falitate to
speed up the memory access by the processor.So that the size
of the structure will increase.

Is This Answer Correct ?    11 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is auto used for in c++?

666


What is friend class in c++ with example?

592


When we use Abstract Class and when we use Interface?where we will implement in real time?

1766


What is the use of vtable?

754


Write a program using shift_half( ) function to shift the elements of first half array to second half and vice versa.

904






What does iomanip mean in c++?

710


Show the declaration for a static function pointer.

660


If you don’t declare a return value, what type of return value is assumed?

631


Which of the following is not a valid declaration for main() a) int main() b) int main(int argc, char *argv[]) c) They both work

700


What does new return if there is insufficient memory to make your new object?

682


Explain the difference between new() and malloc() in c++?

718


What is the difference between cin.read() and cin.getline()?

654


Explain deep copy?

693


What are destructors?

652


Differentiate between a template class and class template in c++?

716