Why should each element of the array have the same data type?

when you look at the data structure recently, there is a question: why should each element of the array have the same data type?

Mar.07,2022

personal opinion: in order to improve the efficiency of storage and reading, if the array allows various types of data, then each element stored will be boxed, and each element read will be unboxed. The steps of boxing and unpacking can be omitted by unifying the data type.


since stipulates , why? This is the same as specifying to take 3.14 , and you have to ask why you can't take 3.1415 . Why is this necessary?


the title itself is incorrect, and different programming languages have different implementations. For example, in js syntax, any type of data can be stored in an array.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e488fd-44cc8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e488fd-44cc8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?