Thursday, July 18, 2013

Storage Issues in Arrays

In arrays, we do have storage under a single name. All the array elements are assigned sequential address starting address from the index 0. Based on the data type we use, we can access the location of the index by increment of the address based on the data type we use.

Here is the table, which states the general address space used by a data type.


Data Type
Size Assigned
int
2 or 4
long
4
Short
2
Float
4
Double
8

Note: Based on the memory models, we can't create the arrays of size more than 64KB. We will discuss how to create more memory size later.

We can get the size of the address fields by using the sizeof() operator. To know more about the sizeof operator click here.