Computer Applications

How is one-dimensional array represented in memory ?

Java Arrays

6 Likes

Answer

Single-dimensional arrays are lists of information of the same type and their elements are stored in contiguous memory locations in their index order.

For example, an array grade of type char with 8 elements declared as

char grade[ ] = new char[8];

will have the element grade[0] at the first allocated memory location, grade[1] at the next contiguous memory location, grade[2] at the next, and so forth. Since grade is a char type array, each element size is 2 bytes and it will be represented in memory as shown in the figure given below:

How is one-dimensional array represented in memory? Arrays, Sumita Arora Computer Applications Solutions ICSE Class 10

Answered By

6 Likes


Related Questions