Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

**C++ 1. Create a static array called myArray which will hold 100 integers. Create another static array called myArray2 which will hold 200 integers. Also

**C++

1. Create a static array called myArray which will hold 100 integers. Create another static array called myArray2 which will hold 200 integers. Also create an integer pointer called myPointer. Static means you will not use the new function call. Your code will then:

a. Fill both arrays with numbers 0 to 99 for myArray, and 100 to 299 for myArray2.

b. Display the addresses (memory locations) of myArray [0] and myArray[99]

c. Display the difference between these two numbers.

d. Question: Subtract the two original memory locations by hand. Is this the correct amount of memory to be used for this array? Explain any differences.

e. Make myPointer point to location 100 in myArray2.

f. Copy all values starting from myPointer to myArray such that it fills it up with the values. Thus, myArray should end up holding values 200 to 299. You may not use array notation such as myPointer[0], but you must dereference variations to myPointer such as *myPointer or *(myPointer + something)

g. Display all the values in myArray separated by a space.

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

Oracle Database 11g SQL

Authors: Jason Price

1st Edition

0071498508, 978-0071498500

More Books

Students also viewed these Databases questions