Current location - Training Enrollment Network - Mathematics courses - Storage differences between homogeneous arrays and heterogeneous arrays
Storage differences between homogeneous arrays and heterogeneous arrays
Isomorphic arrays are elements of the same type. For example, int a []; Floating f[]

Heterogeneous arrays are arrays composed of elements that may be "different types".

For example, an array of objects in java

Object a [];

Class A, Class B and Class C of an object class can all be put into a [].

The element data length of isomorphic array is the same, so you can directly use the element unit length e * number of elements = total space.

Heterogeneous arrays are usually implemented with pointer arrays, pointing to different types of objects.