answersLogoWhite

0

What are the address calculations for accessing arrays?

Updated: 8/20/2019
User Avatar

Wiki User

11y ago

Best Answer

Arrays use a Base Pointer and an Index. They are calculated using the notation BP+IDX*Size, where IDX 0 is the first index location, and Size is the size of each element (at a hardware level, the size is determined by the register the data is loaded into). Languages that start array indexes at 0 use this hardware notation. Other languages start at 1 as a means of being "human friendly", since the zeroth location is the primary cause for developers going "out of bounds" on an array (they forget that the size of the array is one larger than the last index of the array).

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What are the address calculations for accessing arrays?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is an example of a programming problem that would be difficult if not impossible to code without the use of arrays?

Matrix arithmetic calculations, which are very common in all fields of engineering, would be difficult to code without arrays.


Why does array index begins with 0 not with 1?

It is because array name implies its address and if you want to access first element of it pointer address logic is as below: Arrays first element address = array base address + 0 Arrays second element address = array base address + 1


What is the important of pointer in c programming?

It is accessing data by address.


What does a cell address as it applies to Excel 2010 do?

A cell address identifies a particular cell. It can be used in formulas to help in calculations. By using the cell address you can access the value in the cell.A cell address identifies a particular cell. It can be used in formulas to help in calculations. By using the cell address you can access the value in the cell.A cell address identifies a particular cell. It can be used in formulas to help in calculations. By using the cell address you can access the value in the cell.A cell address identifies a particular cell. It can be used in formulas to help in calculations. By using the cell address you can access the value in the cell.A cell address identifies a particular cell. It can be used in formulas to help in calculations. By using the cell address you can access the value in the cell.A cell address identifies a particular cell. It can be used in formulas to help in calculations. By using the cell address you can access the value in the cell.A cell address identifies a particular cell. It can be used in formulas to help in calculations. By using the cell address you can access the value in the cell.A cell address identifies a particular cell. It can be used in formulas to help in calculations. By using the cell address you can access the value in the cell.A cell address identifies a particular cell. It can be used in formulas to help in calculations. By using the cell address you can access the value in the cell.A cell address identifies a particular cell. It can be used in formulas to help in calculations. By using the cell address you can access the value in the cell.A cell address identifies a particular cell. It can be used in formulas to help in calculations. By using the cell address you can access the value in the cell.


Where are some large arrays located?

That's what & operator is good for: gives you the address of the variables.


Whether all devices accessing the internet have ip address?

yes


Why do you use ampersand symbol for arrays and not for a string?

You don't need to use ampersand for arrays; it's entirely optional even for strings (character arrays). This is because arrays will implicitly convert to a pointer at the slightest provocation. Thus for an array named X, you can either pass the array to a function as X, &X or &X[0], they all refer to the exact same address.


What is multidimentional array?

Arrays having more than one dimension is known as multi-dimensional arrays. Multi-dimensional arrays is also known as arrays-of-arrays.


What is a multidimentional array?

Arrays having more than one dimension is known as multi-dimensional arrays. Multi-dimensional arrays is also known as arrays-of-arrays.


What is Difference between index register and stack pointer?

An index register contains an address that can be used during effective address generation, often along with an offset in the instruction or in another register. This is most useful when accessing elements of arrays or structures. A stack pointer is a specialized index register that points to a region of memory that can store temporary elements, in a last-in-first-out structure, such as return addresses, parameters, and local storage for function calls.


What is a PHP function that can sort arrays by other arrays?

You cannot sort arrays by other arrays; that wouldn't make sense, anyway.


What do arrays eat?

Arrays are reported to be omnivoire.