For each of the following, write C++ statements that perform the specified task. Assume that unsigned integers are stored in four bytes and that the starting address of the built-in array is at location 1002500 in memory.

a) Use a for statement to display the elements of built-in array values using pointer/offset notation with the built-in array’s name as the pointer.
b) Use a for statement to display the elements of built-in array values by subscripting the pointer to the built-in array.
c) Refer to the fifth element of values using array subscript notation, pointer/offset notation with the built-in array name’s as the pointer, pointer subscript notation and point- er/offset notation.
d) What address is referenced by vPtr + 3? What value is stored at that location?
e) Assuming that vPtr points to values[4], what address is referenced by vPtr -= 4? What value is stored at that location?

```
a) for (int i{0}; i < SIZE; ++i) {
cout << setw(4) << *(values + i);
}
b) for (int i{0}; i < SIZE; ++i) {
cout << setw(4) << vPtr[i];
}
c) values[4], *(values + 4), vPtr[4], *(vPtr + 4)
d) The address of the location pertaining to values[3] (i.e., 1002506). 8.
e) The address of where values begins in memory (i.e., 1002500). 2.
```

Computer Science & Information Technology

You might also like to view...

Match the following proofing tools with their description

I. Thesaurus II. Interactive spelling check III. Internet research site IV. Reference V. Proofing documents A. Alternative word choices B. Words have red squiggly lines C. Most important final steps D. Bing E. Encarta Dictionary

Computer Science & Information Technology

The numbers on the left side and the letters on the top of an Excel spreadsheet are called cell ________

Fill in the blank(s) with correct word

Computer Science & Information Technology