Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Ch 8 For each of the following, write C++ statements that perform the specified task. Assume that unsigned integers are stored in four bytes and

Ch 8
image text in transcribed
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) Declare an unsigned int built-in array values with five elements initialized to the even integers from 2 to 10. Assume that the constant size has been defined as 5. b) Declare a pointer vPtr that points to an object of type unsigned int. c) Use a for statement to display the elements of built-in array values using array subscript notation. d) Write two separate statements that assign the starting address of built-in array values to pointer variable vPtr. e) Use a for statement to display the elements of built-in array values using pointer/offset notation. f) 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. g) Use a for statement to display the elements of built-in array values by subscripting the pointer to the built-in array. h) 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 pointer/offset notation. i) What address is referenced by vPtr + 3? What value is stored at that location? j) Assuming that vPtr points to values [4], what address is referenced by vPtr 4? What value is stored at that location? For each of the following, write a single statement that performs the specified task. Assume that long variables value 1 and value 2 have been declared and value 1 has been initialized to 200000. a) Declare the variable longPtr to be a pointer to an object of type long. b) Assign the address of variable value 1 to pointer variable longPtr. c) Display the value of the object pointed to by longPtr. d) Assign the value of the object pointed to by longPtr to variable value 2. e) Display the value of value 2. f) Display the address of value 1. g) Display the address stored in longPtr. Is the address displayed the same as value 1's

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Visual Basic 4 Ole Database And Controls Superbible

Authors: Michael Hatmaker, C. Woody Butler, Ibrahim Malluf, Bill Potter

1st Edition

1571690077, 978-1571690074

More Books

Students also viewed these Databases questions

Question

Be familiar with the five basic ways to manage demand.

Answered: 1 week ago