Question: Write c++ code to complete the following tasks: 1. Call 'new' to declare and allocate an array of five integers. Use print_ptr_info(string, ptr) to print

Write c++ code to complete the following tasks: 1. Call 'new' to declare and allocate an array of five integers. Use print_ptr_info(string, ptr) to print out information for the long* array.

2. Iterate over 'array' and initialize each element to '100 + index'. Use print_ptr_info to print out this new information.

3. Create a new 'long* ptr' and set that pointer equal to the 'array' created in Task #1. Use print_ptr_info to print out this new information. Now use the '+' operator and add 3 to 'ptr'. It should now point to 'array[3]'. Use print_ptr_info to print out this new information

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!