memory representation of one dimensional array
Answers
Answered by
22
A one-dimensional array (or single dimension array) is a type of linear array. Accessing its elements involves a single subscript which can either represent a row or column index. ... In the given example the array can contain 10 elements of any value available to the int type
Answered by
36
Memory Representation of 1-D array:
- One-dimensional arrays are allocated in a contiguous block of memory.
- All the elements are stored next to each other.
Example: int a[4]= {10,20,30,40}
- Each element in an array has a unique subscript value from 0 to size of array.
Example: a[0] = 10 , a[1]=20 , a[3] = 30 , a[4] = 40
- As there are 4 integer elements , the array occupies total of 4*2=8 bytes
- let the memory location start at value 100, so the memory representation will look like:
Attachments:
Similar questions
Math,
7 months ago
History,
7 months ago
Math,
7 months ago
Political Science,
1 year ago
Math,
1 year ago
Political Science,
1 year ago