“I bought this guide a few days ago to prepare for my interview with Oracle. Many of the questions they asked me were from this guide. I found this book absolutely great!”
structure is abstract data type!
structures are used to represent data in user defined type.
each member of structure is allocated separate memory, for memory optimization memory padding is to be considered.
contrary in a union memory is not allocated to each member variable, instead to member which occupies highest amount of memory, the same memory is used among all the members.
the main difference b/w structure and union is occupying of size.
the size of the union is depending on the element which has largest size in that union.
where as the size of the structure is sum of all the elements sizes declared in that structure.
the application of structure is to represent different data items in a continuous memory block.
structure is abstract data type!
structures are used to represent data in user defined type.
each member of structure is allocated separate memory, for memory optimization memory padding is to be considered.
contrary in a union memory is not allocated to each member variable, instead to member which occupies highest amount of memory, the same memory is used among all the members.
the main difference b/w structure and union is occupying of size.
the size of the union is depending on the element which has largest size in that union.
where as the size of the structure is sum of all the elements sizes declared in that structure.
the application of structure is to represent different data items in a continuous memory block.
Leave an Answer/Comment