How is Array stored in Memory in Python?
- Python use complex data structure to represent arrays called lists.
- Lists are dynamic arrays, and each element is an object reference.
- In lists elements can be of different data types.
- In lists the memory layout is not necessarily to be contiguous.
Python
arr = [ 1 , 2 , 3 , 4 , 5 ] # Memory representation : (Not contiguous due to object references. ) |
How Array is stored in different programming languages?
The memory representation of an array mainly depends on various programming languages like C, C++, Java, Python, JavaScript, C#, and PHP. So we look at how an array is stored in several popular programming languages :